Command - xdc.tools.closure

From RTSC-Pedia

Jump to: navigation, search
revision tip
—— LANDSCAPE orientation
[printable version]  [offline version]offline version generated on 20-Aug-2014 14:08 UTC

Command - xdc.tools.closure

Closure tool

Contents

Synopsis

 
xs xdc.tools.closure [--help] [-v] [-f] [-i package_name] [-d dest_dir] package_base_dir

Options description:

-v
Print informative messages during execution
The default setting is false. If the options is set, the name of each package and the names of its source and destination repository will be displayed.
-f
Perform aggressive filtering
The default setting is false. In the default mode, only files with certain extensions are removed (xml files, pdf files, unreferenced libraries, etc.), because such files are large, but they are not needed when an application that uses the closed bundle is rebuilt. When this option is set, only header files and referenced libraries are left in the bundle.
-i package_name
Additional packages to be included in the bundle
Packages that are not detected as being loaded during configuration can be added using this option. This option can be repeated on the command line allowing multiple packages to be added.
-d dest_dir
Name of the destination directory
The closed bundle will be saved to the specified directory. If this option is not specified, the default directory name is derived from the name of the application configuration script and the build target's suffix. If the name of the script is app.cfg, and the build target is ti.targets.C64P, the directory name will be app_p64P_rep. The default directory is located in the same directory where the application configuration script is found.

Description

The purpose of this tool is to build a bundle containing all packages loaded in the process of configuring an application. The bundle is built in a user-selected repository, which can be then relocated to a different location or to a different host, where the configured application can be recompiled and relinked.

The closure tool can run only after xdc.tools.configuro runs and finishes the configuration step. Then, xdc.tools.closure detects all packages involved in the configuration and copies them to a new repository. All absolute paths in the relevant generated files that could be accessed by the user's makefile, when the application is rebuilt, are transformed into the paths relative to the the directory containing the closed bundle.

Some files in the copied packages are deleted to keep the size of the closed bundle manageable. By default, only selected files are deleted, but a user has an option of requesting aggressive filtering of files, which leaves in the closed bundle only header files and libraries referenced by linker command files.

Examples

A user building an application would run xdc.tools.closure right after configuring the application using xdc.tools.configuro. After both tools run, the directory bundle contains all packages needed to build the application.

xs xdc.tools.configuro -t gnu.targets.arm.GCArmv6 -o configPkg --cb memory.cfg
xs xdc.tools.closure -i misc.headers -d D:/bundle C:/examples/memory/configPkg

The option -i adds the package misc.headers to the bundle, in the case that header files from that package are found on the package path at the time xdc.tools.configuro built the configuration, but the package itself was never actually loaded. In such cases xdc.tools.closure cannot detect that misc.headers is needed, so it must be added to the bundle using -i.

The bundle can be delivered to another host, copied to C:/temp, and the application can be rebuilt using the following makefile. Besides RTSC packages, the closed bundle contains compiler.opt, a file with -D compiler options copied to C_FLAGS, and linker.cmd, a linker command file added to the linker command line.

BUNDLE=C:/temp/bundle

C_FLAGS = -I$(BUNDLE) -Dxdc_target_types__="gnu/targets/arm/std.h" \
          -Dxdc_target_name__=GCArmv6 -Dxdc_cfg__header__="package/cfg/app_xv6.h"

LD_FLAGS = -L$(BUNDLE)

app.out: app.c
	@$(CL) $(C_FLAGS) app.c 
	@$(LNK) $(LD_FLAGS) -o app.out app.obj $(BUNDLE)/linker.cmd

For TI compilers, the library path is specified using -i options, therefore the example above would look little bit different:

xs xdc.tools.configuro -t ti.targets.C64P -o configPkg --cb memory.cfg
xs xdc.tools.closure -i misc.headers -d D:/bundle C:/examples/memory/configPkg

and

TOOLS   = "C:/Program Files/Texas Instruments2/ccsv4/tools/compiler/c6000/"
CL      = $(TOOLS)/bin/cl6x
LNK     = $(TOOLS)/bin/lnk6x

BUNDLE=C:/temp/bundle

C_FLAGS = -I$(BUNDLE) -mv64p -Dxdc_target_types__="ti/targets/std.h" \
          -Dxdc_target_name__=C64P -Dxdc_cfg__header__="package/cfg/app_x64P.h"

LD_FLAGS = -i$(BUNDLE)

app.out: app.c
	@$(CL) $(C_FLAGS) app.c 
	@$(LNK) $(LD_FLAGS) -o app.out app.obj $(BUNDLE)/linker.cmd -l$(TOOLS)/lib/rts64plus.lib

Usage Note

The generated closed bundle, D:/bundle in the given example, may contain header files that reference (via #include) some of the compiler's header files. Since at the time when xdc.tools.closure runs, the path to the compiler's include directory at the host where the closed bundle will be used is not known, the user may need to add the compiler's include directory to his compiler's options in makefile. Also, the runtime libraries may need to be added, as in the TI tools example above.

[printable version]  [offline version]offline version generated on 20-Aug-2014 14:08 UTC
Copyright © 2008 The Eclipse Foundation. All Rights Reserved
Personal tools
package reference