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

📄 programming.sgml

📁 eCos操作系统源码
💻 SGML
📖 第 1 页 / 共 4 页
字号:
<FIGURE ID="CONFIGURING-FOR-THE-TARGET"><TITLE><!-- <conditionaltext> --><!-- <xref> -->Configuringfor the target</TITLE><GRAPHIC ENTITYREF="programming-graphic3"></GRAPHIC></FIGURE><PARA>Next, select the <EMPHASIS>Build-&#62;Library</EMPHASIS> menuitem to start building <productname>eCos</productname> (see <XREFLINKEND="FIGURE-SELECTING-THE-BUILD-LIBRARY-MENU-ITEM">).  Theapplication will configure the sources, prepare a build tree, andbuild the <FILENAME>libtarget.a</FILENAME> library, which contains the<productname>eCos</productname> kernel and other packages.</PARA><FIGURE ID="FIGURE-SELECTING-THE-BUILD-LIBRARY-MENU-ITEM"><!-- <xref> --><TITLE>Selecting the Build Library menu item</TITLE><GRAPHIC ENTITYREF="programming-graphic4"></GRAPHIC></FIGURE><PARA>The <EMPHASIS>Save As</EMPHASIS> dialog box will appear, askingyou to specify a directory in which to place your save file. Youcan use the default, but it is a good idea to make a subdirectory,called <filename>ecos-work</filename> for example. </PARA><FIGURE><TITLE>Save file dialog</TITLE><GRAPHIC ENTITYREF="programming-graphic5"></GRAPHIC></FIGURE><PARA>The first time you build an <productname>eCos</productname> library for a specificarchitecture, the <application>Configuration Tool</application> may promptyou for the location of the appropriate build tools (including<command>make</command> and<command><replaceable>TARGET-</replaceable>gcc</command>) using a<EMPHASIS>Build Tools</EMPHASIS> dialog box (as shown in <XREFLINKEND="FIGURE-BUILD-TOOLS-DIALOG">). You can select a location fromthe drop down list, browse to the directory using the<EMPHASIS>Browse</EMPHASIS> button, or type in the location of thebuild tools manually.</PARA><FIGURE ID="FIGURE-BUILD-TOOLS-DIALOG"><!-- <xref> --><TITLE>Build tools dialog</TITLE><GRAPHIC ENTITYREF="programming-graphic6"></GRAPHIC></FIGURE><PARA>The <application>Configuration Tool</application> may also prompt youfor the location of the user tools (such as <command>cat</command> and<command>ls</command>) using a <emphasis>User Tools</emphasis> dialogbox (as shown in <XREF LINKEND="FIGURE-USER-TOOLS-DIALOG">). As withthe <EMPHASIS>Build Tools</EMPHASIS> dialog, you can select a locationfrom the drop down list, browse to the directory using the<EMPHASIS>Browse</EMPHASIS> button, or type in the location of theuser tools manually. Note that on Linux, this will often beunnecessary as the tools will already be on your PATH.</PARA><FIGURE ID="FIGURE-USER-TOOLS-DIALOG"><!-- <xref> --><TITLE>User tools dialog</TITLE><GRAPHIC ENTITYREF="programming-graphic7"></GRAPHIC></FIGURE><PARA>When the tool locations have been entered, the <application>ConfigurationTool</application> will configure the sources, prepare a build tree,and build the <filename>libtarget.a</filename> library, which containsthe <productname>eCos</productname> kernel and other packages.</PARA><PARA>The output from the configuration process and the buildingof <filename>libtarget.a</filename> will be shown in the outputwindow.</PARA><PARA>Once the build process has finished you will have a kernelwith other packages in <FILENAME>libtarget.a</FILENAME>. You shouldnow build the <productname>eCos</productname> tests for your particular configuration. </PARA><PARA>You can do this by selecting <EMPHASIS>Build</EMPHASIS> -&#62; <EMPHASIS>Tests</EMPHASIS>.Notice that you could have selected <EMPHASIS>Tests</EMPHASIS> insteadof <EMPHASIS>Library</EMPHASIS> in the earlier step and it wouldhave built <EMPHASIS>both</EMPHASIS> the library and the tests,but this would increase the build time substantially, and if youdo not need to build the tests it is unnecessary.</PARA><FIGURE><TITLE>Selecting the Build Tests menu item</TITLE><GRAPHIC ENTITYREF="programming-graphic8"></GRAPHIC></FIGURE><PARA><XREF LINKEND="RUNNING-AN-ECOS-TEST-CASE"> will guide you through running one	    of the test cases you just built on the selected target,	    using GDB. </PARA></SECT1><!-- ==================================================== --><SECT1 ID="USING-ECOSCONFIG-ON-LINUX"><TITLE><!-- <index></index> -->Ecosconfig on Windows and Linux Quick Start</TITLE><PARA>As an alternative to using the graphical<application>Configuration Tool</application>, it is possible toconfigure and build a kernel by editing a configuration file manuallyand using the <command>ecosconfig</command> command. Users with a Unixbackground may find this tool more suitable than the GUI tooldescribed in the previous section.</PARA><para>Manual configuration and the <command>ecosconfig</command> command aredescribed in detail in <XREF LINKEND="manual-configuration">.</para><para>To use the <command>ecosconfig</command> command you need to start ashell. In Windows you need to start a<productname>CygWin</productname> <command>bash</command> shell, not aDOS command line.</para><!--<para>XXXXX Need to know whether there will be a packaged shell entry in thestart menu, and where XXXXX</para>--><PARA>The following instructions assume that the<literal>PATH</literal> and <literal>ECOS_REPOSITORY</literal>environment variables have been setup correctly as described in <XREFLINKEND="user-guide-installation-linux">.  They also assume Linuxusage but equally well apply to Windows running Cygwin.</PARA><PARA>Before invoking <command>ecosconfig</command> you need tochoose a directory in which to work. For the purposes of this tutorial,the default path will be <FILENAME><replaceable>BASE_DIR</replaceable>/ecos-work</FILENAME>.Create this directory and change to it by typing: </PARA><PROGRAMLISTING>$ mkdir <replaceable>BASE_DIR</replaceable>/ecos-work$ cd <replaceable>BASE_DIR</replaceable>/ecos-work</PROGRAMLISTING><PARA>To see what options can be used with <command>ecosconfig</command>,type: </PARA><PROGRAMLISTING>$ ecosconfig --help</PROGRAMLISTING><PARA>The available packages, targets and templates may be listedas follows:</PARA><PROGRAMLISTING>$ ecosconfig list</PROGRAMLISTING><PARA>Here is sample output from <command>ecosconfig</command> showingthe usage message.</PARA><EXAMPLE><TITLE>Getting <!-- <index></index> --> help from ecosconfig</TITLE><PROGRAMLISTING>$ ecosconfig --helpUsage: ecosconfig [ qualifier ... ] [ command ]  commands are:    list                                       : list repository contents    new TARGET [ TEMPLATE [ VERSION ] ]        : create a configuration    target TARGET                              : change the target hardware    template TEMPLATE [ VERSION ]              : change the template    add PACKAGE [ PACKAGE ... ]                : add package(s)    remove PACKAGE [ PACKAGE ... ]             : remove package(s)    version VERSION PACKAGE [ PACKAGE ... ]    : change version of package(s)    export FILE                                : export minimal config info    import FILE                                : import additional config info    check                                      : check the configuration    resolve                                    : resolve conflicts    tree                                       : create a build tree  qualifiers are:    --config=FILE                              : the configuration file    --prefix=DIRECTORY                         : the install prefix    --srcdir=DIRECTORY                         : the source repository    --no-resolve                               : disable conflictresolution    --version                                  : show version and copyright$</PROGRAMLISTING></EXAMPLE><EXAMPLE><TITLE>ecosconfig output &mdash; <!-- <index></index> -->list of available packages, targets and templates</TITLE><PROGRAMLISTING>$ ecosconfig listPackage CYGPKG_CYGMON (CygMon support via eCos): aliases: cygmon versions: &Version; Package CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS1742 (Wallclock driver for Dallas 1742): aliases: devices_wallclock_ds1742 device_wallclock_ds1742 versions: &Version; Package CYGPKG_DEVICES_WALLCLOCK_SH3 (Wallclock driver for SH3 RTC module): aliases: devices_wallclock_sh3 device_wallclock_sh3 versions: &Version; Package CYGPKG_DEVICES_WATCHDOG_ARM_AEB (Watchdog driver for ARM/AEB board): aliases: devices_watchdog_aeb device_watchdog_aeb versions: &Version; Package CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285 (Watchdog driver for ARM/EBSA285 board): aliases: devices_watchdog_ebsa285 device_watchdog_ebsa285 versions: &Version; &hellip;</PROGRAMLISTING></EXAMPLE><SECT2><TITLE>Selecting a <!-- <index></index> --> Target</TITLE><PARA>To configure for a listed target, type: </PARA><PROGRAMLISTING>$ ecosconfig new &lt;target&#62;</PROGRAMLISTING><PARA>For example, to configure for the ARM PID development board,type: </PARA><PROGRAMLISTING>$ ecosconfig new pid</PROGRAMLISTING><PARA>You can then edit the generated file,<FILENAME>ecos.ecc</FILENAME>, setting the options as required for thetarget (endianess, CPU model, Startup type, etc.).  For detailedinformation about how to edit the <filename>ecos.ecc</filename> file,see the <citetitle>CDL Writer's Guide</citetitle> and <XREFLINKEND="editing-an-ecos-savefile">.</PARA><PARA>Create a build tree for the configured target by typing:</PARA><PROGRAMLISTING>$ ecosconfig tree</PROGRAMLISTING><para>If there are any problem with the configuration,<command>ecosconfig</command> will tell you. The most likely cause ofthis is mistakes when editing the <filename>ecos.ecc</filename> file.You can check whether the configuration you have made is correct,without building the tree with the following command:</para><PROGRAMLISTING>$ ecosconfig check</PROGRAMLISTING><para>If this reports any conflicts you can get<command>ecosconfig</command> to try and resolve them itself by typing:</para><PROGRAMLISTING>$ ecosconfig resolve</PROGRAMLISTING><para>See <XREF LINKEND="conflicts-and-constraints"> for more details.</para><PARA>You can now run the command <command>make</command> or <command>maketests</command>, after which you will be at the same point youwould be after running the <application>Configuration Tool</application>&mdash; you can start developing your own applications,following the steps in <XREF LINKEND="BUILDING-AND-RUNNING-SAMPLE-APPLIATIONS">. </PARA><PARA>The procedure shown above allows you to do very coarse-grainedconfiguration of the <productname>eCos</productname> kernel: you can select which packagesto include in your kernel, and give target and start-up options.But you cannot select components within a package, or set the veryfine-grained options. </PARA><PARA>To select fine-grained configuration options you will need toedit the configuration file <filename>ecos.ecc</filename> in thecurrent directory and regenerate the build tree.</PARA><CAUTION><PARA>You should follow the manual configuration process describedabove very carefully, and you should read the comments in each fileto see when one option depends on other options or packages beingenabled or disabled. If you do not, you might end up with an inconsistentlyconfigured kernel which could fail to build or might executeincorrectly.</PARA></CAUTION></SECT2></SECT1></CHAPTER><!-- ==================================================== --><CHAPTER ID="RUNNING-AN-ECOS-TEST-CASE"><TITLE>Running an <productname>eCos</productname> Test Case</TITLE><PARA>In <XREF LINKEND="using-configtool-windows-linux"> or <XREFLINKEND="using-ecosconfig-on-linux"> you created the <productname>eCos</productname> test casesas part of the build process. Now it is time to try and run one.</para><!-- ==================================================== --><SECT1 id="using-configtool-testcase"><TITLE>Using the <application>Configuration Tool</application></TITLE><PARA>Test executables that have been linked using the<emphasis>Build-&gt;Tests</emphasis> operation against the currentconfiguration can be executed by selecting <EMPHASIS>Tools-&#62;RunTests</EMPHASIS>.</PARA><PARA>When a test run is invoked, a property sheet is displayed, see<xref linkend="programming-run-tests">. Press the <emphasis>UncheckAll</emphasis> button and then find and check just one test,<filename>bin_sem0</filename> for example.</para><FIGURE id="programming-run-tests"><TITLE>Run tests</TITLE><GRAPHIC ENTITYREF="graphic27"></GRAPHIC></FIGURE><para>Now press the <emphasis>Properties</emphasis> button to set upcommunications with the target. This will bring up a properties dialogshown in <xref linkend="programming-run-properties">. If you haveconnected the target board via a serial cable, check the<emphasis>Serial</emphasis> radio button, and select the serial portand baud rate for the board. If the target is connected via thenetwork select the <emphasis>TCP/IP</emphasis> button and enter the IPaddress that the board has been given, and the port number (usually9000).

⌨️ 快捷键说明

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