summaryrefslogtreecommitdiffstats
blob: 894576e44d3c089beb63c864cd080b76b45e9558 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/******************************************************************************
 * FILE PURPOSE: Build description for the PA LLD Package
 ******************************************************************************
 * FILE NAME: package.bld
 *
 * DESCRIPTION: 
 *  This file contains the build specification and description for the PA LLD
 *  
 *  The file takes the following parameters from the command line through the
 *  XDCARGS variable.
 *      XDCARGS[0] = PA LLD Install Type 
 *      Valid Values are "TAR" or "SETUP"
 *      DEFAULT is "SETUP"
 *
 *  Example for a valid command:
 *      xdc XDCARGS="SETUP" release   
 *
 * Copyright (C) 2011, Texas Instruments, Inc.
 *****************************************************************************/

/* List of all subdirectories that combine to make the PA LLD Package. */
var subDirectories = [ "src", "docs", "fw", "example", "test" , "device"];

var palldInstallType;

/* Check if we need to create the Makefiles? */
var miniBuild = java.lang.System.getenv("MINI_PACKAGE");

/* Determine if we need to create the InstallJammer Application or not? 
 * PA LLD Deliverables be either of the following formats:
 *  - TAR Ball Package
 *  - Setup Executable 
 * DEFAULT is a SETUP Executable. */

if ((arguments[0] != "TAR") && (arguments[0] != "SETUP"))
    palldInstallType = "TAR";
else
    palldInstallType = arguments[0];

/* Irrespective of the InstallType we always create a TAR Ball Package as a part
 * of the RTSC Build. Here we determine the name of the TAR Ball Package
 *  Format is as follows:
 *      palld_<version> */
var palldRTSCFileName = "palld" + "_" + palldPartNumber + "_" +
                         palldReleaseVersion[0] + "_" +  palldReleaseVersion[1] + "_" + 
                         palldReleaseVersion[2]  + "_" + palldReleaseVersion[3];

/******************************************************************
 ************************ Release Banner **************************
 ******************************************************************/

print ("************* PA LLD Build Information *************");
print ("PA LLD Install             : " + palldInstallType);
print ("PA LLD Version             : " + palldReleaseVersion);
print ("C66 Tools Directory        : " + c66ToolsBaseDir);
print ("A15 Tools Directory        : " + a15ToolsBaseDir);
print ("RTSC File Name	           : " + palldRTSCFileName);
print ("PA LLD Path                : " + palldPath);
print ("Coverity Analysis          : " + (coverityAnalysis == "ON" ? "ON" : "OFF"));
if(xdcTargetType ==  "ARM11") 
{
    print ("ARM LE opts                : " + TIArmv6le.ccOpts.prefix);
    print ("ARM BE opts                : " + TIArmv6be.ccOpts.prefix);
}
else
{
    print ("A15 basic opts             : " + A15LE.ccOpts.prefix);
    print ("C66  LE opts               : " + C66LE.ccOpts.prefix);
    print ("C66  BE opts               : " + C66BE.ccOpts.prefix);
}
print ("***********************************************************");

/* Create the release package for the PA LLD */
Pkg.defaultRelease = Pkg.addRelease (palldRTSCFileName, {prefix: "./packages/"});

/* Moving forward we need to set the Archiver of the package to be ZIP. This is currently
 * not supported in the XDC tools being used. Currenly builds need to be done with the 
 * following options:-
 *   xdc MK_FIXLISTOPTS=-t release 
 * ZIP is a better option as it works natively with INSTALL Jammer and we can remove the
 * uncompression into a temporary directory. XDC Tools with xdc-rXX support the ZIP archiver. */
//Pkg.attrs = {archiver : "zip"};

/* Cycle through all the sub-directories and build all the files */
for (var i = 0; i < subDirectories.length; i++) 
{
    /* Load the capsule in the sub directory. */
    var caps = xdc.loadCapsule (subDirectories[i]+"/Module.xs");

    print ("Building directory " + subDirectories[i]);

    /* Build the capsule. */
    caps.modBuild();

    /* Package the module.xs files for building via package */
    Pkg.otherFiles[Pkg.otherFiles.length++] = subDirectories[i]+"/Module.xs";
}

/* Package the remaining files */
Pkg.otherFiles[Pkg.otherFiles.length++] = "config.bld";
Pkg.otherFiles[Pkg.otherFiles.length++] = "package.bld";
Pkg.otherFiles[Pkg.otherFiles.length++] = "package.xdc";
Pkg.otherFiles[Pkg.otherFiles.length++] = "package.xs";
Pkg.otherFiles[Pkg.otherFiles.length++] = "Settings.xdc";
Pkg.otherFiles[Pkg.otherFiles.length++] = "Settings.xdc.xdt";
Pkg.otherFiles[Pkg.otherFiles.length++] = "pa.h";
Pkg.otherFiles[Pkg.otherFiles.length++] = "pa_fc.h";
Pkg.otherFiles[Pkg.otherFiles.length++] = "paver.h";
Pkg.otherFiles[Pkg.otherFiles.length++] = "paver.h.xdt";
Pkg.otherFiles[Pkg.otherFiles.length++] = "pasahost.h";
Pkg.otherFiles[Pkg.otherFiles.length++] = "pa_osal.h";
Pkg.otherFiles[Pkg.otherFiles.length++] = "nss_if.h";
Pkg.otherFiles[Pkg.otherFiles.length++] = "nss_cfg.h";
Pkg.otherFiles[Pkg.otherFiles.length++] = "docs/Doxyfile";
Pkg.otherFiles[Pkg.otherFiles.length++] = "docs/doxyfile.xdt";
Pkg.otherFiles[Pkg.otherFiles.length++] = "build/buildlib.xs";
Pkg.otherFiles[Pkg.otherFiles.length++] = "makefile";
Pkg.otherFiles[Pkg.otherFiles.length++] = "makefile_armv7";
Pkg.otherFiles[Pkg.otherFiles.length++] = "build/armv7/libpa_aearmv7.mk";

/* Generate Users Manual Doxyfile */
var tplt = xdc.loadTemplate("./docs/doxyfile.xdt");
tplt.genFile("./docs/Doxyfile",palldReleaseVersion); 

/* Generate Settings.xdc */
var tplt = xdc.loadTemplate("./Settings.xdc.xdt");
tplt.genFile("./Settings.xdc",palldReleaseVersion); 

/* Generate paver.h */
var tplt = xdc.loadTemplate("./paver.h.xdt");
tplt.genFile("./paver.h",palldReleaseVersion);      
     

/********************************************************************* 
 *********************** INSTALL-JAMMER Support **********************
 * In order to create the InstallJammer Application; we need to UNTAR
 * the package into a temporary directory. This is required because 
 * currently the InstallJammer does not support the TAR Files and thus
 * creating an UNTAR of the file. So to work-around the problem we will
 * do the following in the EPILOGUE Section:-
 *  (a) Create a temporary directory called 'tmp'
 *  (b) UNTAR the package into 'tmp'
 *  (c) Run the INSTALL Jammer on 'tmp'
 *  (d) Remove the 'tmp' directory.
 *
 * This can be done only after the 'release' package has been created.
 * Thus all of this work is being done in the EPILOGUE.
 *********************************************************************/
if (palldInstallType == "SETUP")
{
    /* Create the Install Jammer Version Variable. This is used inside the 
     * MPI File to create the Final executable. 
     *  The format supported is as follows:-
     *   - setupwin32_palld-<part_number>-<version>.exe 
     */
    var InstallJammerVersion = "-DVersion " + palldPartNumber + "_" + 
                               palldReleaseVersion[0] + "_" + palldReleaseVersion[1] + "_" +  
                               palldReleaseVersion[2]  + "_" + palldReleaseVersion[3];

    /* This is the location where the tmp directory is located; this is used as 
     * the input directory for the Install Jammer. */ 
    var PackageBaseDir = " -DPackageBaseDir " + palldPath + "./tmp";

    /* This is the location where the PA LLD will be installed by default. */
    var WinInstallDir = " -DWinInstallDir C:/Program Files/Texas Instruments/palld" + "_" + 
                            palldPartNumber + "_" + 
                            palldReleaseVersion[0] + "_" +  palldReleaseVersion[1] + "_" +  
                            palldReleaseVersion[2]  + "_" + palldReleaseVersion[3]; 

    /* Create the actual EPILOGUE Section for the INSTALLER */
    Pkg.makeEpilogue += "release: install_application\n";
    Pkg.makeEpilogue += "install_application: firmware\n";
    Pkg.makeEpilogue += "\t @echo -------------------------------------------------------\n";
    Pkg.makeEpilogue += "\t @echo Creating the Install\n";
    Pkg.makeEpilogue += "\t @echo -------------------------------------------------------\n";
    Pkg.makeEpilogue += "\t -$(MKDIR) tmp\n";
    Pkg.makeEpilogue += "\t -$(MKDIR) tmp/packages\n";
    Pkg.makeEpilogue += "\t -$(MKDIR) tmp/eclipse\n";
    Pkg.makeEpilogue += "\t -$(CP) -R eclipse tmp\n";
    Pkg.makeEpilogue += "\t tar -xf ./packages/" + palldRTSCFileName + ".tar" + " -Ctmp/packages \n";
    Pkg.makeEpilogue += "\t installjammer " + InstallJammerVersion + PackageBaseDir + WinInstallDir + 
                        " --output-dir packages/ --build install/palld.mpi\n";
    Pkg.makeEpilogue += "\t -$(RMDIR) /S /Q tmp\n\n";

    /* We need to clean after ourselves; extend the 'clean' target to take care of this. */
    Pkg.makeEpilogue += "clean::\n";
    Pkg.makeEpilogue += "\t $(RM) packages/*.exe\n";
    Pkg.makeEpilogue += "\t $(RM) packages/*.bin\n";
    Pkg.makeEpilogue += "\t $(RMDIR) /S /Q eclipse\n";
    Pkg.makeEpilogue += "\t $(RMDIR) /S /Q tmp\n";
}

if (miniBuild == "ON")
{
    /***************************************************************************
    ********************************* MINI Package ****************************
    ***************************************************************************/
    /* Create the MINI RTSC Package */
    var additionalFiles = [];

    additionalFiles[additionalFiles.length++] = "fw/classify1_bin.c";
    additionalFiles[additionalFiles.length++] = "fw/classify2_bin.c";
    additionalFiles[additionalFiles.length++] = "fw/pam_bin.c";
    additionalFiles[additionalFiles.length++] = "fw/pafw.h";
 
    var libUtility = xdc.loadCapsule ("build/buildlib.xs");
    libUtility.createMiniPkg(palldRTSCFileName, additionalFiles);
}