Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 370990

Summary: Support arguments in mkpkg.xdt script
Product: [Technology] RTSC Reporter: Ramsey Harris <ramsey>
Component: ToolsAssignee: Dave Russo <d-russo>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: cring
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Ramsey Harris CLA 2012-02-08 13:21:48 EST
I am using the xdc.tools.mkpkg package (indirectly through tisb.utils.genbundle) to generate SysLink examples. In my example template, I have an mkpkg.xdt template script which lists the files to be processed. I would like to expand the same template file multiple times into different output folders, like this:

mkpkg.xdt
-----------
%%{
    this.platform = "ti.platforms.evm3530";
%%}

slave/main_slave.c -> dsp/main_dsp.c
slave/main_slave.c -> video/main_video.c
slave/main_slave.c -> vpss/main_vpss.c
-----------

However, my template (main_salve.c) needs some arguments in order to expand correctly. For example, in the above use-case, I would like to pass in the name of the platform and the target processor. Ideally, something like the following:

mkpkg.xdt
-----------
slave/main_slave.c -> dsp/main_dsp.c "ti.platforms.evm3530" "dsp"
slave/main_slave.c -> video/main_video.c "ti.platforms.evm3530" "video"
slave/main_slave.c -> vpss/main_vpss.c "ti.platforms.evm3530" "vpss"
-----------

In the template script, I would access the arguments as follows:

main_slave.c
--------------
%%{
    var platform = this.arguments[0];
    var core = this.arguments[1];
%%}
--------------

This is currently not supported by the xdc.tools.mkpkg package.

As a work around, I'm invoking the mkpkg package directly inside of my mkpkg.xdt template as follows:

mkpkg.xdt
-----------
%%{
    var Mkpkg = xdc.module('xdc.tools.mkpkg.Main');
%%}

% Mkpkg.mkpkg(inFile, outFile, platform, "dsp");
-----------

This has the disadvantage that my script needs to know how it was invoked. If it's invoked using the arrow syntax (in -> out), then it looks for parameters using the 'this' object. However, if it's invoked using Mkpkg, then it looks for parameters using the 'this.arguments' object.

Furthermore, constructing the Mkpkg command requires prepending the inPath and outPath provided to the genbundle command which requires additional processing in the mkpkg.xdt script.

For reference, look in $TREES/sl/sl-c18/src/examples/templates/ex01_helloworld