Target Setup
To Contents | To previous page | To next page

## Target Setup

### Connecting To A Target Via Serial

While eCos supports a variety of targets, communication with the targets happens in one of four ways. These are descibed in general below.

The descriptions are followed by descriptions of each target, providing specific details of how to set up the target (if hardware) and the necessary communication information (such as baud rate for hardware targets, or special connection options for simulator targets).

Most targets will have eCos GDB stubs or CygMon installed. These normally wait for GDB to connect at 38400 baud, using 8 data bit, no parity bit and 1 stop-bit (no hardware flow control). Check the section for your target to ensure it uses this speed. If not, adjust the following instructions accordingly.

The following instructions depend on you to select the appropriate serial port on the host - the serial port which connects to the target's (primary) serial port. On Linux this could be /dev/ttyS0, while the same port on Windows would be named COM1, or
/dev/ttya on Solaris. Substitute the proper serial port name in the below.

Connect to the target by issuing the following commands in GDB console mode:

    (gdb) set remotebaud 38400
    (gdb) set mips-force-32bit-saved-gpregs
    (gdb) target remote /dev/ttyS0

In Insight, connect by opening the File->Target Settings ... window and enter:

    Target: Remote/Serial
    Baud Rate: 38400
    Port: /dev/ttyS0

You will also need to open the GDB console window with View->Console and enter "set mips-force-32bit-saved-gpregs" at the prompt

Set other options according to preference, close the window and select
Run->Connect to target .

### Connecting To A Target Via Ethernet

Some targets allow GDB to connect via Ethernet - if so, it will be mentioned in the section describing the target. Substitute the target's assigned IP address or hostname for <hostname> in the following. The <port> is the TCP port which the eCos GDB stub or CygWin is listening on. It is also listed in the section describing the target.

Connect to the target by issuing the following command in GDB console mode:

    (gdb) target remote <hostname>:<port>

In Insight, connect by opening the File->Target Settings ... window and enter:

    Target: Remote/TCP
    Hostname: <hostname>
    Port: <port>

Set other options according to preference, close the window and select
Run->Connect to target .

### Connecting To A Simulator Target

GDB connects to all simulator targets using the same basic command, although each simulator may require additional options. These are listed in the section describing the target, and should be used when connecting.

Connect to the target by issuing the following command in GDB console mode:

    (gdb) target sim [target specific options]

In Insight, connect by opening the File->Target Settings ... window and enter:

    Target: Simulator
    Options: [target specific options]

Set other options according to preference, close the window and select
Run->Connect to target .

### Connecting To A Synthetic Target

Synthetic targets are special in that the built tests and applications actually run as native applications on the host. This means that there is no target to connect to - the test or application can be run directly from the GDB console using:

    (gdb) run

or from Insight by pressing the Run icon. There is therefore no need to connect to the target or download the application, so you should ignore GDB "target" and "load" commands in any instructions found in other places in the documentation.

### PowerPC Cogent Hardware Setup

The eCos Developer's Kit package comes with an EPROM which provides GDB support for the Cogent evaluation board. An image of this EPROM is also provided at `loaders/powerpc-cogent/gdbload.bin` under the root of your eCos installation. The same EPROM and image can be used on all three supported daughterboards: CMA287-23 (MPC823), CMA287-50 (MPC850), and CMA286-60 (MPC860).

The EPROM is installed to socket U4 on the board. Attention should be paid to the correct orientation of the EPROM during installation.

If you are going to burn a new EPROM using the binary image, be careful to get the byte order correct. It needs to be big-endian. If the EPROM burner software has a hex-editor, check that the first few bytes of the image look like:

    00000000: 3c60 fff0 6063 2000 7c68 03a6 4e80 0020 <`..`c .|h..N..

If the byte order is wrong you will see 603c instead of 3c60 etc. Use the EPROM burner software to make a byte-swap before you burn to image to the EPROM.

If the GDB stub EPROM you burn does not work, try reversing the byte-order, even if you think you have it the right way around. At least one DOS-based EPROM burner program is known to have the byte-order upside down.

The GDB stub in the EPROM allows communication with GDB using the serial port at connector P12 (CMA101) or P3 (CMA102). The communication parameters are fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). No flow control is employed. Connection to the host computer should be made using a dedicated serial cable as specified in the Cogent CMA manual.

### Installing the Stubs into ROM

#### Preparing the Binaries

These two binary preparation steps are not strictly necessary as the eCos distribution ships with precompiled binaries in the directory loaders/powerpc-cogent relative to the installation root.

##### Building the ROM images with the eCos Configuration Tool

1. Start with a new document - selecting the File->New menu item if necessary to do this.

2. Choose the Build->Templates menu item, and then select the PowerPC CMA28x hardware.

3. While still displaying the Build->Templates dialog box, select the "stubs" package template to build a GDB stub. Click OK .

4. Build eCos using Build->Library .

5. When the build completes, the image files can be found in the bin/ subdirectory of the install tree. GDB stub ROM images have the prefix "gdb_module".

##### Building the ROM images with ecosconfig

1. Make an empty directory to contain the build tree, and cd into it.

2. To build a GDB stub ROM image, enter the command:
   `$ ecosconfig new cma28x stubs`

3. Enter the commands:
   `$ ecosconfig tree
   $ make`

4. When the build completes, the image files can be found in the bin/ subdirectory of the install tree. GDB stub ROM images have the prefix "gdb_module".

#### Installing the Stubs into ROM or FLASH

1. Program the binary image file gdb_module.bin into ROM or FLASH referring to the instructions of your ROM programmer.

2. Plug the ROM/FLASH into socket U4 as described at the beginning of this Hardware Setup section.

### PowerPC MBX860 Hardware Setup

The eCos Developer's Kit package comes with an EPROM which provides GDB support for the Motorola PowerPC MBX860 evaluation board. An image of this EPROM is also provided at `loaders/powerpc-mbx/gdbload.bin` under the root of your eCos installation.

The EPROM is installed to socket XU1 on the board. Attention should be paid to the correct orientation of the EPROM during installation. Only replace the board's existing ROM using a proper PLCC extraction tool, as the socket would otherwise risk getting damaged.

The GDB stub in the EPROM allows communication with GDB using the serial port at connector SMC1/COM1. The communication parameters are fixed at 38400 baud, 8 data bits, no parity bit and 1 stop bit (8-N-1). No flow control is employed. Connection to the host computer should be made using a suitable serial cable.

In order to make the board execute the EPROM that you just installed (rather than the on-board FLASH memory), it may be necessary move some links on the board. Specifically, ensure that link J4 is in position 1-2. If in doubt, refer to the MBX documentation from Motorola, ensuring that Boot Port Size=8 Bits/ROM for BOOT (CS#7), in their terminology.

### Installing the Stubs into FLASH

#### Preparing the Binaries

These two binary preparation steps are not strictly necessary as the eCos distribution ships with precompiled binaries in the directory loaders/powerpc-mbx relative to the installation root.

##### Building the ROM images with the eCos Configuration Tool

1. Start with a new document - selecting the File->New menu item if necessary to do this.

2. Choose the Build->Templates menu item, and then select the PowerPC Motorola MBX860/821 hardware.

3. While still displaying the Build->Templates dialog box, select the "stubs" package template to build a GDB stub. Click OK .

4. Build eCos using Build->Library .

5. When the build completes, the image files can be found in the bin/ subdirectory of the install tree. GDB stub ROM images have the prefix "gdb_module".

##### Building the ROM images with ecosconfig

1. Make an empty directory to contain the build tree, and cd into it.

2. To build a GDB stub ROM image, enter the command:
   `$ ecosconfig new mbx stubs`

3. Enter the commands:
   `$ ecosconfig tree
   $ make`

4. When the build completes, the image files can be found in the bin/ subdirectory of the install tree. GDB stub ROM images have the prefix "gdb_module".

#### Installing the Stubs into ROM

1. Program the binary image file gdb_module.bin into ROM or FLASH referring to the instructions of your ROM programmer.

2. Plug the ROM/FLASH into socket XU1 as described near the beginning of this Hardware Setup section.

#### Installing the Stubs into FLASH

This assumes you have EPPC-Bug in the on-board flash. This can be determined by setting up the board according to the below instructions and powering up the board. The EPPC-Bug prompt should appear on the SMC1 connector at 9600 baud, 8N1.

1. Set jumper 3 to 2-3 [allow XU2 flash to be programmed]

2. Set jumper 4 to 2-3 [boot EPPC-Bug]

##### Program FLASH

1. Prepare EPPC-Bug for download:
   `EPPC-Bug>lo 0
   ` At this point the monitor is ready for input. It will not return the prompt until the file has been downloaded.

2. Use the terminal emulator's ASCII download feature (or a simple clipboard copy/paste operation) to download the gdb_module.srec data.
   Note that on Linux, Minicom's ASCII download feature seems to be broken. A workaround is to load the file into emacs (or another editor) and copy the full contents to the clipboard. Then press the mouse paste-button (usually the middle one) over the Minicom window.

3. Program the flash with the downloaded data:
   `EPPC-Bug>pflash 40000 60000 fc000000`

4. Switch off the power, and change jumper 4 to 1-2. Turn on the power again. The board should now boot using the newly programmed stubs.

### PowerPC Architectural Simulator Setup

The PowerPC simulator is an architectural simulator which implements all the features of the PowerPC needed to run eCos. The current implementation provides accurate simulation of the instruction set and timers, as well as having generic support for diagnostic output and exceptions.

The simulator also allows devices to be simulated, but no device simulation support has been defined for the serial device drivers in this release.

To simplify connection to the simulator, you are advised to create a GDB macro by putting the following code in your personal GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX).

    define psim
     target sim -o  ™/iobus/pal@0xf0001000/reg 0xf0001000 32'
     rbreak cyg_test_exit
     rbreak cyg_assert_fail
    end

You can then connect to the simulator by invoking the command `psim` on the command line:

     (gdb) psim

You can achieve the same effect by typing out the macro's content on the command line if necessary.

### NOTE:

The PowerPC simulator cannot execute binaries built for any of the supported hardware targets.

###
i386/Linux Synthetic Target Setup

When building for the synthetic Linux target, the resulting binaries are native Linux applications with the HAL providing suitable bindings between the eCos kernel and the Linux kernel.

### NOTE:

Please be aware that the current implementation of the Linux synthetic target does not allow thread-aware debugging.

These Linux applications cannot be run on a Windows system. However, it is possible to write a similar HAL emulation for the Windows kernel if such a testing target is desired.

### Tools

For the synthetic target, eCos relies on features not available in native compilers earlier than gcc-2.95.1. It also requires version 2.9.5 or later of the GNU linker. If you have gcc-2.95.1 or later and ld version 2.9.5 or later, then you do not need to build new tools. eCos does not support earlier versions. You can check the compiler version using `gcc -v` or `egcs -v` , and the linker version using `ld -v` .

If you have native tools that are sufficiently recent for use with eCos, you should be aware that by default eCos assumes that the tools i686-pc-linux-gnu-gcc, i686-pc-linux-gnu-ar, i686-pc-linux-gnu-ld, and i686-pc-linux-gnu-objcopy are on your system and are the correct versions for use with eCos. But instead, you can tell eCos to use your native tools by editting the configuration value "Global command prefix" (CYGBLD_GLOBAL_COMMAND_PREFIX) in your eCos configuration. If left empty (i.e. set to the empty string) eCos will use your native tools when building.

If you have any difficulties, it is almost certainly easiest overall to rebuild the tools as described on:

http://sourceware.cygnus.com/ecos/getstart.html

Target Setup
To Contents | To previous page | To next page