⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 synth-running.html

📁 encos_rtos一款精致小巧的实时嵌入式操作系统 +CODEWORR 教程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
         </P
></DD
></DL
></DIV
><P
>The I/O auxiliary loads support for the various devices dynamically
and some devices may accept additional command line arguments. Details
of these can be obtained using the <TT
CLASS="OPTION"
>-h</TT
> option or by
consulting the device-specific documentation. If an unrecognised
command line argument is used then a warning will be issued.
    </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SYNTH-RUNNING-TDF"
></A
><H2
>The Target Definition File</H2
><P
>The eCos application will want to access devices such as
<TT
CLASS="VARNAME"
>eth0</TT
> or <TT
CLASS="VARNAME"
>/dev/ser0</TT
>. These need to
be mapped on to Linux devices. For example some users may all traffic
on the eCos <TT
CLASS="VARNAME"
>/dev/ser0</TT
> serial device to go via the
Linux serial device <TT
CLASS="VARNAME"
>/dev/ttyS1</TT
>, while ethernet I/O
for the eCos <TT
CLASS="VARNAME"
>eth0</TT
> device should be mapped to the
Linux ethertap device <TT
CLASS="VARNAME"
>tap3</TT
>. Some devices may need
additional configuration information, for example to limit the
number of packets that should be buffered within the I/O auxiliary.
The target definition file provides all this information.
    </P
><P
>By default the I/O auxiliary will look for a file
<TT
CLASS="FILENAME"
>default.tdf</TT
>. An alternative target definition can
be specified on the command line using <TT
CLASS="OPTION"
>-t</TT
>, for
example:
    </P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="SCREEN"
>$ bridge_app --io -t twineth</PRE
></TD
></TR
></TABLE
><P
>A <TT
CLASS="FILENAME"
>.tdf</TT
> suffix will be appended automatically if
necessary. If a relative pathname is used then the I/O auxiliary will
search for the target definition file in the current directory, then
in <TT
CLASS="FILENAME"
>~/.ecos/synth/</TT
>, and finally
in its install location.
    </P
><P
>A typical target definition file might look like this:
    </P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>synth_device console {
    # appearance -foreground white -background black
    filter trace {^TRACE:.*} -foreground HotPink1 -hide 1
}

synth_device ethernet {
    eth0 real eth1
    eth1 ethertap tap4 00:01:02:03:FE:06

    ## Maximum number of packets that should be buffered per interface.
    ## Default 16
    #max_buffer 32

    ## Filters for the various recognised protocols.
    ## By default all filters are visible and use standard colours.
    filter ether  -hide 0
    #filter arp    -hide 1
    #filter ipv4   -hide 1
    #filter ipv6   -hide 1
}</PRE
></TD
></TR
></TABLE
><P
>A target definition file is actually a Tcl script that gets run in the
main interpreter of the I/O auxiliary during initialization. This
provides a lot of flexibility if necessary. For example the script
could open a socket to a resource management server of some sort to
determine which hardware facilities are already in use and adapt
accordingly. Another possibility is to adapt based on <A
HREF="synth-new-host.html#SYNTH-NEW-HOST-ARGS"
>command line arguments</A
>. Users who
are not familiar with Tcl programming should still be able to edit a
simple target definition file without too much difficulty, using a
mixture of cut'n'paste, commenting or uncommenting various lines, and
making small edits such as changing <TT
CLASS="LITERAL"
>tap4</TT
> to
<TT
CLASS="LITERAL"
>eth2</TT
>. 
    </P
><P
>Each type of device will have its own entry in the target definition
file, taking the form:
    </P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>synth_device &lt;device type&gt; {
    &lt;options&gt;
}</PRE
></TD
></TR
></TABLE
><P
>The documentaton for each synthetic target device should provide
details of the options available for that device, and often a suitable
fragment that can be pasted into a target definition file and edited.
There is no specific set of options that a given device will always
provide. However in practice many devices will use common code
exported by the main I/O auxiliary, or their implementation will
involve some re-use of code for an existing device. Hence certain
types of option are common to many devices.
    </P
><P
>A good example of this is filters, which control the appearance of
text output. The above target definition file defines a filter
<TT
CLASS="VARNAME"
>trace</TT
> for output from the eCos application. The
regular expression will match output from the infrastructure package's
tracing facilities when <TT
CLASS="VARNAME"
>CYGDBG_USE_TRACING</TT
> and
<TT
CLASS="VARNAME"
>CYGDBG_INFRA_DEBUG_TRACE_ASSERT_SIMPLE</TT
> are enabled.
With the current settings this output will not be visible by default,
but can be made visible using the menu item <SPAN
CLASS="GUIMENUITEM"
>System
Filters</SPAN
>. If made visible the trace output will appear in
an unusual colour, so users can easily distinguish the trace output
from other text. All filters accept the following options:
    </P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="OPTION"
>-hide [0|1]</TT
></DT
><DD
><P
>This controls whether or not text matching this filter should be
invisible by default or not. At run-time the visibility of each filter
can be controlled using the <SPAN
CLASS="GUIMENUITEM"
>System Filters</SPAN
>
menu item.
         </P
></DD
><DT
><TT
CLASS="OPTION"
>-foreground &lt;colour&gt;</TT
></DT
><DD
><P
>This specifies the foreground colour for all text matching this
filter. The colour can be specified using an RGB value such as
<TT
CLASS="LITERAL"
>#F08010</TT
>, or a symbolic name such as
<TT
CLASS="LITERAL"
>"light steel blue"</TT
>. The X11 utility
<SPAN
CLASS="APPLICATION"
>showrgb</SPAN
> can be used to find out
about the available colours.
         </P
></DD
><DT
><TT
CLASS="OPTION"
>-background &lt;colour&gt;</TT
></DT
><DD
><P
>This specifies the background colour for all text matching the filter.
As with <TT
CLASS="OPTION"
>-foreground</TT
> the colour can be specified using
a symbolic name or an RGB value.
         </P
></DD
></DL
></DIV
><P
>Some devices may create their own subwindows, for example to monitor
ethernet traffic or to provide additional I/O facilities such as
emulated LED's or buttons. Usually the target definition file can be
used to control the <A
HREF="synth-gui.html#SYNTH-GUI-LAYOUT"
>layout</A
> of
these windows.
    </P
><P
>The I/O auxiliary will not normally warn about
<B
CLASS="COMMAND"
>synth_device</B
> entries in the target definition file
for devices that are not actually needed by the current eCos
application. This makes it easier to use a single file for several
different applications. However it can lead to confusion if an entry
is spelled incorrectly and hence does not actually get used. The
<TT
CLASS="OPTION"
>-V</TT
> command line option can be used to get warnings
about unused device entries in the target definition file.
    </P
><P
>If the body of a <B
CLASS="COMMAND"
>synth_device</B
> command contains an
unrecognised option and the relevant device is in use, the I/O
auxiliary will always issue a warning about such options.
    </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SYNTH-RUNNING-USER-CONFIG"
></A
><H2
>User Configuration Files</H2
><P
>During initialization the I/O auxiliary will execute two user
configuration files, <TT
CLASS="FILENAME"
>initrc.tcl</TT
> and
<TT
CLASS="FILENAME"
>mainrc.tcl</TT
>. It will look for these files in the
directory <TT
CLASS="FILENAME"
>~/.ecos/synth/</TT
>. If
that directory does not yet exist it will be created and populated
with initial dummy files.
    </P
><P
>Both of these configuration files are Tcl scripts and will be run in
the main interpreter used by the I/O auxiliary itself. This means that
they have full access to the internals of the auxiliary including the
various Tk widgets, and they can perform file or socket I/O if
desired. The section <A
HREF="synth-new-host.html"
>Writing New Devices - host</A
> contains
information about the facilities available on the host-side for
writing new device drivers, and these can also be used in the
initialization scripts.
    </P
><P
>The <TT
CLASS="FILENAME"
>initrc.tcl</TT
> script is run before the auxiliary
has processed any requests from the eCos application, and hence before
any devices have been instantiated. At this point the generic
command-line arguments has been processed, the target definition file
has been read in, and the hooks functionality has been initialized. If
running in graphical mode the main window will have been created, but
has been withdrawn from the screen to allow new widgets to be added
without annoying screen flicker. A typical
<TT
CLASS="FILENAME"
>initrc.tcl</TT
> script could add some menu or toolbar
options, or install a hook function that will be run when the
eCos application exits.
    </P
><P
>The <TT
CLASS="FILENAME"
>mainrc.tcl</TT
> script is run after eCos has
performed all its device initialization and after C++ static
constructors have run, and just before the call to
<TT
CLASS="FUNCTION"
>cyg_start</TT
> which will end up transferring control
to the application itself. A typical <TT
CLASS="FILENAME"
>mainrc.tcl</TT
>
script could look at what interrupt vectors have been allocated to
which devices and create a little monitor window that shows interrupt
activity. 
    </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SYNTH-RUNNING-SESSION"
></A
><H2
>Session Information</H2
><P
>When running in graphical mode, the I/O auxiliary will read in a file
<TT
CLASS="FILENAME"
>~/.ecos/synth/guisession</TT
> containing session
information. This file should not normally be edited manually, instead
it gets updated automatically when the auxiliary exits. The purpose of
this file is to hold configuration options that are manipulated via
the graphical interface, for example which browser should be used to
display online help.
    </P
><DIV
CLASS="WARNING"
><P
></P
><TABLE
CLASS="WARNING"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Warning</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>GUI session functionality is not yet available in the current release.
When that functionality is fully implemented it is possible that some
target definition file options may be removed, to be replaced by
graphical editing via a suitable preferences dialog, with the
current settings saved in the session file.
    </P
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="synth-install.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ecos-ref.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="synth-gui.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Installation</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="hal-synth-arch.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The I/O Auxiliary's User Interface</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -