Creating the Build Tree

Generating a build tree is a non-trivial operation and should not be attempted manually. Instead, eCos is shipped with a program called pkgconf.tcl which provides the required functionality. This program is implemented in the scripting language Tcl/Tk and it needs to be run inside a Tcl interpreter. The use of a scripting language eliminates the need to ship separate pkgconf binary executables for every host platform. However, it does mean that the host machine must have a suitable interpreter installed: pkgconf.tcl requires Tcl 8.0 or later. Most Linux users will have a suitable interpreter pre-installed, usually in /usr/bin/tclsh: if the installed interpreter is not version 8.0 or later then this will be detected at run-time and remedial action will be suggested. For Windows users, a suitable interpreter cygtclsh80.exe is shipped with the system as part of the Cygwin tools.

pkgconf.tcl does not generate the top-level directory of the build tree itself; you must do this yourself.


$ mkdir ecos-work
$ cd ecos-work

The next step is to run the pkgconf.tcl script using the Tcl interpreter. Remembering that BASE_DIR is the base directory in which we installed eCos, on a UNIX machine the command for this would be:


$ tclsh BASE_DIR/pkgconf.tcl <arguments>

Under Windows NT, with the bash shell, the equivalent command would be:


$ cygtclsh80 BASE_DIR/pkgconf.tcl <arguments>

In the remainder of this chapter the UNIX version will be used for all examples, since eCos developers with Windows NT hosts are more likely to use the graphical configuration tool.

If pkgconf.tcl is given a --help argument then it will give some basic information about the legal arguments. Reference information for pkgconf.tcl is located in Chapter 9.

When a build tree is first created it is necessary to specify the target hardware. For details of the hardware that is supported in the current distribution, it is possible to invoke pkgconf.tcl with a --targets arguments.


$ tclsh BASE_DIR/pkgconf.tcl --targets

This will result in a fairly significant amount of output, which will increase further as eCos is ported to more and more architectures. The output is organized on a per-architecture basis. The supported architectures include MN10300, TX39, and PowerPC. The desired architecture has to be specified on the command line.


$ tclsh BASE_DIR/pkgconf.tcl --target=mn10300  

This will create a build tree corresponding to the mn10300 architecture and the default platform for that architecture, the stdeval1 evaluation board. It will also use the default startup for that platform, RAM startup, which means that any executables produced will be suitable for downloading into a board equipped with the CygMon ROM monitor. The alternative startup, ROM, would be appropriate if the executable is intended to be burned into EPROMs.

pkgconf.tcl is fairly flexible in its argument parsing so it will accept a number of different ways of specifying its arguments. All of the following commands are equivalent:


$ tclsh BASE_DIR/pkgconf.tcl --target=mn10300
% tclsh BASE_DIR/pkgconf.tcl --target mn10300
$ tclsh BASE_DIR/pkgconf.tcl -target mn10300
$ tclsh BASE_DIR/pkgconf.tcl -target=mn10300

In addition, pkgconf.tcl will accept several aliases for the architecture. For example, it is possible to specify --target=mn10300-elf, matching the architecture prefix that is used for the compiler mn10300-elf-gcc and other tools. All recognized aliases will be listed in the output of pkgconf.tcl --targets.

For most architectures there will be some number of supported platforms, also listed in the output of pkgconf.tcl --targets. For example, the supported platforms for the TX39 architecture include the JMR3904 evaluation board and a minimal simulator. By default pkgconf.tcl will use the first listed platform for a given architecture. It is possible to override this using a --platform command line argument, for example:


$ tclsh BASE_DIR/pkgconf.tcl --target=tx39 --platform=sim

Some platforms support multiple startups. This is not true of the tx39 simulator where RAM startup is the only option, but on the JMR3904 board both RAM and ROM startup are possible. The output from pkgconf.tcl --targets includes details of all the startups that are available for a given platform. By default pkgconf.tcl will use the first one that is listed, but it is possible to override this using a --startup command line argument:


$ tclsh BASE_DIR/pkgconf.tcl --target=tx39 --platform=jmr3904 --startup=rom

The output from pkgconf.tcl --targets also includes details of software packages that are associated with particular architectures and platforms. Details of how pkgconf.tcl handles software packages are given below.

Since pkgconf.tcl is located at the top level of the component repository it is not necessary to specify the location of the repository explicitly: instead this can be determined automatically by examining the arguments passed to tclsh. It is possible to override this on the command line by using a --srcdir argument, but this should rarely be necessary. pkgconf.tcl assumes that the current directory is the build tree, but this can be overridden using a --builddir command line argument. It also assumes that the install tree should be in an "install" directory inside the build tree, but this can be overridden using a --prefix arguments. The reference documentation should be consulted for more details of these arguments.