This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

one compilation unit with xdc tools

I'm compiling a package with cl6x compiler and using xdc tools. The build process is configured by the following file package.bld:

var Build = xdc.useModule('xdc.bld.BuildEnvironment');

var Pkg = xdc.useModule('xdc.bld.PackageContents');

Pkg.attrs.exportSrc =true;

Pkg.generatedFiles.$add("lib/");

Pkg.otherFiles.$add("package.bld");

var SRCS = ["file0", "file1"];

for (var i = 0; i < Build.targets.length; i++) {

   var targ = Build.targets[i];

for (var profile in targ.profiles) {

var libName = "lib/" + profile + "/mylib";

       var fullLibName = libName + '.a' + targ.suffix;

        print("building for target " + targ.name + " profile " + profile + " ...");

               Pkg.attrs.profile = profile;

        Pkg.addLibrary(libName, targ, {

            profile: profile,

            copts: "-k -mw --opt_level=3 --auto_inline=100 --gen_opt_info=2"

        }).addObjects(SRCS);

Since file0.c and file1.c belong to different compilation units, it is not possible for the compiler to perform a deeper optimization, as for example inlining of a function defined in file1.c and called in both files.

Is there a way in the xdc tools to tell the compiler to compile both files in one compilation unit, in order to perform all the optimization?

Thank you

Best regards

  • I lack expertise with XDC tools.  So I cannot tell you how to have it invoke the compiler on multiple C files at once.  It may not be possible.  But, for now, let's presume it is possible.

    You still have some other things to think about.  And those are all covered in this wiki article.

    With that said, I'll move this thread over to the RTOS forum, where there are some XDC experts who can help.

    Thanks and regards,

    -George

  • Francesco,
    package.bld files do not support multiple files on the command line. The usual approach when users want to do something that package.bld can't do is to create a custom makefile that does the custom build, and then include that custom makefile in package.bld:
    Pkg.makeEpilogue = "include custom.mak";
    where custom.mak is the name of the make file.
    Also, package.xs has to implement the function getLibs() so that the library file generated by custom.mak is supplied when the package is loaded in a configuration.

    I am just giving a short overview of that approach here. If you decide to try it, I can help you with some additional details that I skipped over.