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
.
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
.
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
.
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.
The eCos Developer's Kit package comes with a pair of EPROMs which provide GDB support for the Matsushita MN10300 (AM31) series evaluation board using CygMon, the Cygnus ROM monitor. Images of these EPROMs are also provided at BASE_DIR/loaders/mn10300-stdeval1/cygmon.bin . The LSB EPROM (LROM) is installed to socket IC8 on the board and the MSB EPROM (UROM) is installed to socket IC9. Attention should be paid to the correct orientation of these EPROMs during installation.
The CygMon stubs allows communication with GDB by way of the serial port at connector CN2. 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 standard RS232C serial cable (not a null modem cable). A gender changer may also be required.
The MN10300 simulator is an architectural simulator for the Matsushita MN10300 that implements all features of the microprocessor necessary to run eCos. The current implementation provides accurate simulation of the instruction set, interrupt controller, timers, and serial I/O.
In this release, you can run the same eCos binaries in the simulator that can run on target hardware, if built for ROM start-up, with the exception of those that use the watchdog timer.
However, note that AM33 devices required to run eCos are not simulated; therefore you cannot run eCos binaries built for the AM33 under the simulator. For the AM33, the simulator is effectively an instruction-set only simulator.
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 msim target sim --board=stdeval1 --memory-region 0x34004000,0x8 rbreak cyg_test_exit rbreak cyg_assert_fail end
You can then connect to the simulator by invoking the command msim on the command line:
(gdb) msim
You can achieve the same effect by typing out the macro's content on the command line if necessary.
The Matsushita AM33 STB System Reference Board may be used in two modes: via a JTAG debugger, or by means of a GDB stub ROM.
The eCos Developer's Kit package comes with a ROM image which provides GDB support for the Matsushita(R) AM33 STB System Reference Board. To install the GDB stub ROM requires the use of the JTAG debugger and the Flash ROM programming code available from Matsushita. An image of this ROM is also provided at loaders/am33-stb/gdbload.bin under the root of your eCos installation.
Ensure that there is a Flash ROM card in MAIN MEMORY SLOT <0>. Follow the directions for programming a Flash ROM supplied with the programming software.
The final programming of the ROM will need to be done with a command similar to the following:
fdown "gdbload.bin",0x80000000,16,1
Once the ROM has been programmed, close down the JTAG debugger, turn the STB off, and disconnect the JTAG cable. Ensure that the hardware switches are in the following configuration:
U U D D D U D D D = lower part of rocker switch pushed in U = upper part of rocker switch pushed in
This is also the configuration required by the Flash programming code, so it should not be necessary to change these.
Restart the STB and the stub ROM will now be able to communicate with GDB . eCos programs should be built with RAM startup.
Programs can then be downloaded via a standard RS232 null modem serial cable connected to the SERIAL1 connector on the STB front panel (the AM33's serial port 0). This line is programmed to run at 38400 baud, 8 data bits, no parity and 1 stop bit (8-N-1) with no flow control. A gender changer may also be required. Diagnostic output will be output to GDB using the same connection.
This procedure also applies for programming ROM startup eCos programs into ROM, given a binary format image of the program from mn10300-elf-objcopy.
To use eCos from the JTAG debugger, executables must be built with ROM startup and then downloaded via the JTAG debugger. For this to work there must be an SDRAM memory card in SUB MEMORY SLOT <0> and the hardware switches on the front panel set to the following:
D U D D D U D D D = lower part of rocker switch pushed in U = upper part of rocker switch pushed in
Connect the JTAG unit and run the debugger as described in the documentation that comes with it.
eCos executables should be renamed to have a ".out" extension and may then be loaded using the debugger's "l" or "lp" commands.
Diagnostic output generated by the program will be sent out of the AM33's serial port 0 which is connected to the SERIAL1 connector on the STB front panel. This line is programmed to run at 38400 baud, 8 data bits, no parity, and one stop bit (8-N-1) with no flow control. Connection to the host computer should be using a standard RS232 null modem serial cable. A gender changer may also be required.
eCos comes with a pre-built GDB stub ROM image for the AM33-STB platform. This can be found at loaders/am33-stb/gdbload.bin relative to the eCos installation directory.
If necessary, the ROM image can be re-built as follows:
where BASE_DIR is the path to the eCos installation directory.
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.
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.
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 | ||
---|---|---|