📄 synth-install.html
字号:
<!-- Copyright (C) 2003 Red Hat, Inc. --><!-- This material may be distributed only subject to the terms --><!-- and conditions set forth in the Open Publication License, v1.0 --><!-- or later (the latest version is presently available at --><!-- http://www.opencontent.org/openpub/). --><!-- Distribution of the work or derivative of the work in any --><!-- standard (paper) book form is prohibited unless prior --><!-- permission is obtained from the copyright holder. --><HTML><HEAD><TITLE>Installation</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="eCos Synthetic Target"HREF="hal-synth-arch.html"><LINKREL="PREVIOUS"TITLE="Overview"HREF="synth.html"><LINKREL="NEXT"TITLE="Running a Synthetic Target Application"HREF="synth-running.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="synth.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="synth-running.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="SYNTH-INSTALL">Installation</H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN17701"></A><H2>Name</H2>Installation -- Preparing to use the synthetic target</DIV><DIVCLASS="REFSECT1"><ANAME="SYNTH-INSTALL-HOST"></A><H2>Host-side Software</H2><P>To get the full functionality of the synthetic target, users mustbuild and install the I/O auxiliary ecosynth and various supportfiles. It is possible to develop applications for the synthetic targetwithout the auxiliary, but only limited I/O facilities will beavailable. The relevant code resides in the <TTCLASS="FILENAME">host</TT> subdirectory of the synthetic targetarchitectural HAL package, and building it involves the standard<BCLASS="COMMAND">configure</B>, <BCLASS="COMMAND">make</B>, and<BCLASS="COMMAND">make install</B> steps. </P><P>There are two main ways of building the host-side software. It ispossible to build both the generic host-side software and allpackage-specific host-side software, including the I/O auxiliary. in asingle build tree. This involves using the<BCLASS="COMMAND">configure</B> script at the toplevel of the eCosrepository, which will automatically search the <TTCLASS="FILENAME">packages</TT> hierarchy for host-sidesoftware. For more information on this, see the<TTCLASS="FILENAME">README.host</TT> file at the top of the repository.Note that if you have an existing build tree which does not includethe synthetic target architectural HAL package then it will benecessary to rerun the toplevel configure script: the search forappropriate packages happens at configure time. </P><P>The alternative is to build just the host-side for this package.This involves creating a suitable build directory and running the<BCLASS="COMMAND">configure</B> script. Note that building directly inthe source tree is not allowed. </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="SCREEN">$ cd <somewhere suitable>$ mkdir synth_build$ cd synth_build$ <repo<>/packages/hal/synth/arch/<version>/host/configure <options>$ make$ make install</PRE></TD></TR></TABLE><P>The code makes extensive use of Tcl/TK and requires version 8.3 orlater. This is checked by the <BCLASS="COMMAND">configure</B> script. Bydefault it will use the system's Tcl installation in <TTCLASS="FILENAME">/usr</TT>. If a different, more recent Tclinstallation should be used then its location can be specified usingthe options <TTCLASS="OPTION">--with-tcl=<path></TT>,<TTCLASS="OPTION">--with-tcl-header=<path></TT> and<TTCLASS="OPTION">--with-tcl-lib=<path></TT>. For more information on these optionssee the <TTCLASS="FILENAME">README.host</TT> file at the toplevel of theeCos repository. </P><P>Some users may also want to specify the install location using a<TTCLASS="OPTION">--prefix=<path></TT> option. The default installlocation is <TTCLASS="FILENAME">/usr/local</TT>. It isessential that the <TTCLASS="FILENAME">bin</TT>subdirectory of the install location is on the user's search<TTCLASS="ENVAR">PATH</TT>, otherwise the eCos application will be unable tolocate and execute the I/O auxiliary ecosynth. </P><P>Because ecosynth is run automatically by an eCos application ratherthan explicitly by the user, it is not installed in the <TTCLASS="FILENAME">bin</TT> subdirectory itself. Instead it isinstalled below <TTCLASS="FILENAME">libexec</TT>,together with various support files such as images. At configure timeit is usually possible to specify an alternative location for<TTCLASS="FILENAME">libexec</TT> using<TTCLASS="OPTION">--exec-prefix=<path></TT> or<TTCLASS="OPTION">--libexecdir=<path></TT>. These options should notbe used for this package because the eCos application is builtcompletely separately and does not know how the host-side wasconfigured. </P></DIV><DIVCLASS="REFSECT1"><ANAME="SYNTH-TOOLS"></A><H2>Toolchain</H2><P>When developing eCos applications for a normal embedded target it isnecessary to use a suitable cross-compiler and related tools such asthe linker. Developing for the synthetic target is easier because youcan just use the standard GNU tools (gcc, g++, ld, …) whichwere provided with your Linux distribution, or which you used to buildyour own Linux setup. Any reasonably recent version of the tools, forexample gcc 2.96(Red Hat) as shipped with Red Hat Linux 7, should besufficient. </P><P>There is one important limitation when using these tools: current gdbwill not support debugging of eCos threads on the synthetic target. Asfar as gdb is concerned a synthetic target application isindistinguishable from a normal Linux application, so it assumes thatany threads will be created by calls to the Linux<TTCLASS="FUNCTION">pthread_create</TT> function provided by the Clibrary. Obviously this is not the case since the application is neverlinked with that library. Therefore gdb never notices the eCos threadmechanisms and assumes the application is single-threaded. Fixing thisis possible but would involve non-trivial changes to gdb. </P><P>Theoretically it is possible to develop synthetic target applicationson, for example, a PC running Windows and then run the resultingexecutables on another machine that runs Linux. This is rarely useful:if a Linux machine is available then usually that machine will also beused for building ecos and the application. However, if for somereason it is necessary or desirable to build on another machine thenthis requires a suitable cross-compiler and related tools. If theapplication will be running on a typical PC with an x86 processor thena suitable configure triplet would be<TTCLASS="USERINPUT"><B>i686-pc-linux-gnu</B></TT>. The installationinstructions for the various GNU tools should be consulted for furtherinformation. </P></DIV><DIVCLASS="REFSECT1"><ANAME="SYNTH-HARDWARE"></A><H2>Hardware Preparation</H2><P>Preparing a real embedded target for eCos development can be tricky.Often the first step is to install suitable firmware, usually RedBoot.This means creating and building a special configuration for eCos withthe RedBoot template, then somehow updating the target's flash chipswith the resulting RedBoot image. Typically it will also be necessaryto get a working serial connection, and possibly set up ethernet aswell. Although usually none of the individual steps are particularlycomplicated, there are plenty of ways in which things can go wrong andit can be hard to figure out what is actually happening. Of coursesome board manufacturers make life easier for their developers byshipping hardware with RedBoot preinstalled, but even then it is stillnecessary to set up communication between host and target. </P><P>None of this is applicable to the synthetic target. Instead you canjust build a normal eCos configuration, link your application with theresulting libraries, and you end up with an executable that you canrun directly on your Linux machine or via gdb. A useful side effect ofthis is that application development can start before any realembedded hardware is actually available. </P><P>Typically the memory map for a synthetic target application will beset up such that there is a read-only ROM region containing all thecode and constant data, and a read-write RAM region for the data. Thedefault locations and sizes of these regions depend on the specificplatform being used for development. Note that the application alwaysexecutes out of ROM: on a real embedded target much of the developmentwould involve running RedBoot firmware there, with application codeand data loaded into RAM; usually this would change for the finalsystem; the firmware would be replaced by the eCos application itself,configured for ROM bootstrap, and it would perform the appropriatehardware initialization. Therefore the synthetic target actuallyemulates the behaviour of a final system, not of a developmentenvironment. In practice this is rarely significant, although havingthe code in read-only memory can help catch some problems inapplication code. </P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="synth.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="synth-running.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Overview</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="hal-synth-arch.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Running a Synthetic Target Application</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -