1 <!-- Copyright (C) 2002 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
12 >Running a Synthetic Target Application</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Synthetic Target"
20 HREF="hal-synth-arch.html"><LINK
23 HREF="synth-install.html"><LINK
25 TITLE="The I/O Auxiliary's User Interface"
26 HREF="synth-gui.html"></HEAD
37 SUMMARY="Header navigation table"
46 >eCos Synthetic Target</TH
54 HREF="synth-install.html"
79 NAME="SYNTH-RUNNING">Running a Synthetic Target Application</H1
87 >Execution -- Arguments and configuration files</DIV
91 NAME="SYNTH-RUNNING-DESCRIPTION"
96 >The procedure for configuring and building eCos and an application for
97 the synthetic target is the same as for any other eCos target. Once an
98 executable has been built it can be run like any Linux program, for
99 example from a shell prompt,
109 >$ ecos_hello <options></PRE
124 >$ gdb --nw --quiet --args ecos_hello <options>
126 Starting program: ecos_hello <options></PRE
131 >By default use of the I/O auxiliary is disabled. If its I/O facilities
132 are required then the option <TT
144 >In future the default behaviour may change, with the I/O auxiliary
145 being started by default. The option <TT
149 used to prevent the auxiliary from being run.
157 NAME="SYNTH-RUNNING-ARGUMENTS"
160 >Command-line Arguments</H2
162 >The syntax for running a synthetic target application is:
172 >$ <ecos_app> [options] [-- [app_options]]</PRE
177 >Command line options up to the <TT
181 the I/O auxiliary. Subsequent arguments are not passed on to the
182 auxiliary, and hence can be used by the eCos application itself. The
183 full set of arguments can be accessed through the variables
186 >cyg_hal_sys_argc</TT
190 >cyg_hal_sys_argv</TT
194 >The following options are accepted as standard:
208 >This option causes the eCos application to spawn the I/O auxiliary
209 during HAL initialization. Without this option only limited I/O will
220 >This option prevents the eCos application from spawning the I/O
221 auxiliary. In the current version of the software this is the default.
234 >The I/O auxiliary can either provide a graphical user interface, or it
235 can run in a text-only mode. The default is to provide the graphical
236 interface, but this can be disabled with <TT
240 Emulation of some devices, for example buttons connected to digital
241 inputs, requires the graphical interface.
257 > causes the I/O auxiliary to provide a
258 graphical user interface. This is the default.
274 > option can be used to determine the version of
275 the I/O auxiliary being used and where it has been installed. Both the
276 auxiliary and the eCos application will exit immediately.
292 > causes the I/O auxiliary to list all accepted
293 command-line arguments. This happens after all devices have been
294 initialized, since the host-side support for some of the devices may
295 extend the list of recognised options. After this both the auxiliary
296 and the eCos application will exit immediately. This option implies
313 >If an error occurs in the I/O auxiliary while reading in any of the
314 configuration files or initializing devices, by default both the
315 auxiliary and the eCos application will exit. The <TT
319 option can be used to make the auxiliary continue in spite of errors,
320 although obviously it may not be fully functional.
333 >Normally the auxiliary processes two <A
334 HREF="synth-running.html#SYNTH-RUNNING-USER-CONFIG"
335 >user configuration files</A
344 >. This can be suppressed using the
361 >When providing a graphical user interface the I/O auxiliary will
362 normally continue running even after the eCos application has exited.
363 This allows the user to take actions such as saving the current
364 contents of the main text window. If run with <TT
368 the auxiliary will exit as soon the application exits.
381 >When the graphical user interface is disabled with
385 > the I/O auxiliary will normally exit immediately
386 when the eCos application exits. Without the graphical frontend there
387 is usually no way for the user to interact directly with the
388 auxiliary, so there is no point in continuing to run once the eCos
389 application will no longer request any I/O operations. Specifying the
393 > option causes the auxiliary to continue running
394 even after the application has exited.
407 >This option causes the I/O auxiliary to output some additional
408 information, especially during initialization.
417 >--logfile <file></TT
421 >Much of the output of the eCos application and the I/O auxiliary is
422 simple text, for example resulting from eCos
430 When running in graphical mode this output goes to a central text
431 window, and can be saved to a file or edited via menus. The
435 > can be used to automatically generate an
436 additional logfile containing all the text. If graphical
437 mode is disabled then by default all the text just goes to the current
438 standard output. Specifying <TT
442 text to go into a logfile instead, although some messages such as
443 errors generated by the auxiliary itself will still go to stdout as
453 >--target <file></TT
457 >During initialization the I/O auxiliary reads in a target definition
458 file. This file holds information such as which Linux devices should
459 be used to emulate the various eCos devices. The <TT
463 option can be used to specify which target definition should be used
464 for the current run, defaulting to <TT
468 It is not necessary to include the <TT
472 this will be appended automatically if necessary.
478 >-geometry <geometry></TT
482 >This option can be used to control the size and position of the main
483 window, as per X conventions.
489 >The I/O auxiliary loads support for the various devices dynamically
490 and some devices may accept additional command line arguments. Details
491 of these can be obtained using the <TT
495 consulting the device-specific documentation. If an unrecognised
496 command line argument is used then a warning will be issued.
502 NAME="SYNTH-RUNNING-TDF"
505 >The Target Definition File</H2
507 >The eCos application will want to access devices such as
515 be mapped on to Linux devices. For example some users may all traffic
519 > serial device to go via the
520 Linux serial device <TT
523 >, while ethernet I/O
527 > device should be mapped to the
528 Linux ethertap device <TT
531 >. Some devices may need
532 additional configuration information, for example to limit the
533 number of packets that should be buffered within the I/O auxiliary.
534 The target definition file provides all this information.
537 >By default the I/O auxiliary will look for a file
541 >. An alternative target definition can
542 be specified on the command line using <TT
556 >$ bridge_app --io -t twineth</PRE
564 > suffix will be appended automatically if
565 necessary. If a relative pathname is used then the I/O auxiliary will
566 search for the target definition file in the current directory, then
571 in its install location.
574 >A typical target definition file might look like this:
583 CLASS="PROGRAMLISTING"
584 >synth_device console {
585 # appearance -foreground white -background black
586 filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
589 synth_device ethernet {
591 eth1 ethertap tap4 00:01:02:03:FE:06
593 ## Maximum number of packets that should be buffered per interface.
597 ## Filters for the various recognised protocols.
598 ## By default all filters are visible and use standard colours.
608 >A target definition file is actually a Tcl script that gets run in the
609 main interpreter of the I/O auxiliary during initialization. This
610 provides a lot of flexibility if necessary. For example the script
611 could open a socket to a resource management server of some sort to
612 determine which hardware facilities are already in use and adapt
613 accordingly. Another possibility is to adapt based on <A
614 HREF="synth-new-host.html#SYNTH-NEW-HOST-ARGS"
615 >command line arguments</A
617 are not familiar with Tcl programming should still be able to edit a
618 simple target definition file without too much difficulty, using a
619 mixture of cut'n'paste, commenting or uncommenting various lines, and
620 making small edits such as changing <TT
630 >Each type of device will have its own entry in the target definition
631 file, taking the form:
640 CLASS="PROGRAMLISTING"
641 >synth_device <device type> {
648 >The documentaton for each synthetic target device should provide
649 details of the options available for that device, and often a suitable
650 fragment that can be pasted into a target definition file and edited.
651 There is no specific set of options that a given device will always
652 provide. However in practice many devices will use common code
653 exported by the main I/O auxiliary, or their implementation will
654 involve some re-use of code for an existing device. Hence certain
655 types of option are common to many devices.
658 >A good example of this is filters, which control the appearance of
659 text output. The above target definition file defines a filter
663 > for output from the eCos application. The
664 regular expression will match output from the infrastructure package's
665 tracing facilities when <TT
667 >CYGDBG_USE_TRACING</TT
671 >CYGDBG_INFRA_DEBUG_TRACE_ASSERT_SIMPLE</TT
673 With the current settings this output will not be visible by default,
674 but can be made visible using the menu item <SPAN
678 >. If made visible the trace output will appear in
679 an unusual colour, so users can easily distinguish the trace output
680 from other text. All filters accept the following options:
694 >This controls whether or not text matching this filter should be
695 invisible by default or not. At run-time the visibility of each filter
696 can be controlled using the <SPAN
698 >System Filters</SPAN
706 >-foreground <colour></TT
710 >This specifies the foreground colour for all text matching this
711 filter. The colour can be specified using an RGB value such as
715 >, or a symbolic name such as
718 >"light steel blue"</TT
723 > can be used to find out
724 about the available colours.
730 >-background <colour></TT
734 >This specifies the background colour for all text matching the filter.
738 > the colour can be specified using
739 a symbolic name or an RGB value.
745 >Some devices may create their own subwindows, for example to monitor
746 ethernet traffic or to provide additional I/O facilities such as
747 emulated LED's or buttons. Usually the target definition file can be
748 used to control the <A
749 HREF="synth-gui.html#SYNTH-GUI-LAYOUT"
755 >The I/O auxiliary will not normally warn about
759 > entries in the target definition file
760 for devices that are not actually needed by the current eCos
761 application. This makes it easier to use a single file for several
762 different applications. However it can lead to confusion if an entry
763 is spelled incorrectly and hence does not actually get used. The
767 > command line option can be used to get warnings
768 about unused device entries in the target definition file.
774 > command contains an
775 unrecognised option and the relevant device is in use, the I/O
776 auxiliary will always issue a warning about such options.
782 NAME="SYNTH-RUNNING-USER-CONFIG"
785 >User Configuration Files</H2
787 >During initialization the I/O auxiliary will execute two user
788 configuration files, <TT
795 >. It will look for these files in the
800 that directory does not yet exist it will be created and populated
801 with initial dummy files.
804 >Both of these configuration files are Tcl scripts and will be run in
805 the main interpreter used by the I/O auxiliary itself. This means that
806 they have full access to the internals of the auxiliary including the
807 various Tk widgets, and they can perform file or socket I/O if
808 desired. The section <A
809 HREF="synth-new-host.html"
810 >Writing New Devices - host</A
812 information about the facilities available on the host-side for
813 writing new device drivers, and these can also be used in the
814 initialization scripts.
820 > script is run before the auxiliary
821 has processed any requests from the eCos application, and hence before
822 any devices have been instantiated. At this point the generic
823 command-line arguments has been processed, the target definition file
824 has been read in, and the hooks functionality has been initialized. If
825 running in graphical mode the main window will have been created, but
826 has been withdrawn from the screen to allow new widgets to be added
827 without annoying screen flicker. A typical
831 > script could add some menu or toolbar
832 options, or install a hook function that will be run when the
833 eCos application exits.
839 > script is run after eCos has
840 performed all its device initialization and after C++ static
841 constructors have run, and just before the call to
845 > which will end up transferring control
846 to the application itself. A typical <TT
850 script could look at what interrupt vectors have been allocated to
851 which devices and create a little monitor window that shows interrupt
858 NAME="SYNTH-RUNNING-SESSION"
861 >Session Information</H2
863 >When running in graphical mode, the I/O auxiliary will read in a file
866 >~/.ecos/synth/guisession</TT
868 information. This file should not normally be edited manually, instead
869 it gets updated automatically when the auxiliary exits. The purpose of
870 this file is to hold configuration options that are manipulated via
871 the graphical interface, for example which browser should be used to
893 >GUI session functionality is not yet available in the current release.
894 When that functionality is fully implemented it is possible that some
895 target definition file options may be removed, to be replaced by
896 graphical editing via a suitable preferences dialog, with the
897 current settings saved in the session file.
909 SUMMARY="Footer navigation table"
920 HREF="synth-install.html"
929 HREF="hal-synth-arch.html"
938 HREF="synth-gui.html"
958 >The I/O Auxiliary's User Interface</TD