]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ivimm/ipumm.git/blob - build/common.bld
[MJPEGE] Codec Update 01.00.17.01
[ivimm/ipumm.git] / build / common.bld
1 /*
2  * Copyright (c) 2011-2015, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*
33  *  ======== common.bld ========
34  *
35  */
38 /*
39  *  ======== getCores ========
40  *  Determines which cores to build for.
41  *
42  *  Any argument in XDCARGS which does not contain core= is treated
43  *  as a core name. This way build for multiple cores can be specified by
44  *  separating them with a space.
45  */
46 function getCores(xdcArgs)
47 {
48     var coreNames = new Array();
50     /* Check for any XDCARGS with core=; these are the corenames */
51     for (var i = 0; i < xdcArgs.length; i++) {
52         if (xdcArgs[i].match(/core=/)) {
53             coreNames.push(xdcArgs[i].substr(5));
54         }
55     }
57     return coreNames;
58 }
61 /*
62  *  ======== getProfiles ========
63  *  Determines which profiles to build for.
64  *
65  *  Any argument in XDCARGS which does not contain platform= is treated
66  *  as a profile. This way multiple build profiles can be specified by
67  *  separating them with a space.
68  */
69 function getProfiles(xdcArgs)
70 {
71     var profiles = new Array();
73     /* Check for any XDCARGS with profile=; these are profiles. */
74     for (var i = 0; i < xdcArgs.length; i++) {
75         if (xdcArgs[i].match(/profile=/)) {
76             profiles.push(xdcArgs[i].substr(8));
77         }
78     }
80     return profiles;
81 }
83 function getBuildModes(xdcArgs)
84 {
85     var buildModes = new Array();
87     /* Check for any XDCARGS with buildMode=; these are specific
88        build configuration */
89     for (var i = 0; i < xdcArgs.length; i++) {
90         if (xdcArgs[i].match(/buildMode=/)) {
91             buildModes.push(xdcArgs[i].substr(10));
92         }
93     }
94     return buildModes;
95 }
98 /*
99  *  ======== getTraceType ========
100  *  Determines which trace type to build for.
101  *
102  *  Any argument in XDCARGS which does not contain trace_type= is treated
103  *  as a trace type name. This way build for different trace type can be specified by
104  *  separating them with a space.
105  * XDCARGS="profile=debug core=app_m3 target_build=BUILD_OMAP4 trace_type=UIA_SW_ON"
106  */
107 function getTraceType(xdcArgs)
109     var trace_type = new Array();
111     /* Check for any XDCARGS with trace_type=; these are the corenames */
112     for (var i = 0; i < xdcArgs.length; i++) {
113         if (xdcArgs[i].match(/trace_type=/)) {
114             trace_type.push(xdcArgs[i].substr(11));
115         }
116     }
118     return trace_type;
122 /*
123  *  ======== getLoadType ========
124  *  Determines whether ducati load is enabled or not .
125  *
126  *  XDCARGS="profile=debug core=app_m3 target_build=BUILD_OMAP4 load_type=LOAD_ON
127  */
128 function getLoadType(xdcArgs)
130     var load_type = new Array();
132     /* Check for any XDCARGS with load_type=; these are the corenames */
133     for (var i = 0; i < xdcArgs.length; i++) {
134         if (xdcArgs[i].match(/load_type=/)) {
135             load_type.push(xdcArgs[i].substr(10));
136         }
137     }
139     return load_type;
143 /*
144  *  ======== getTimerType ========
145  *  Determines which trace type to build for.
146  *
147  *  XDCARGS="profile=debug core=app_m3 target_build=BUILD_OMAP4 timer_type=CTM_ON
148  */
149 function getTimerType(xdcArgs)
151     var timer_type = new Array();
153     /* Check for any XDCARGS with timer_type=;  */
154     for (var i = 0; i < xdcArgs.length; i++) {
155         if (xdcArgs[i].match(/timer_type=/)) {
156             timer_type.push(xdcArgs[i].substr(11));
157         }
158     }
160     return timer_type;
164 /*
165  *  ======== getVidPerfMsmtMode ========
166  *  Determines whether ducati video performance measurement is turned ON.
167  *
168  *  XDCARGS="profile=debug core=app_m3 target_build=BUILD_OMAP4 video_perf_mode=MSMT_ON
169  */
170 function getVidPerfMsmtMode(xdcArgs)
172     var video_perf_mode = new Array();
174     /* Check for any XDCARGS with video_perf_mode=; these are the corenames */
175     for (var i = 0; i < xdcArgs.length; i++) {
176         if (xdcArgs[i].match(/video_perf_mode=/)) {
177             video_perf_mode.push(xdcArgs[i].substr(16));
178         }
179     }
181     return video_perf_mode;
186 /*
187  *  ======== getTraceMode ========
188  *  Determines which trace mode to use.
189  *
190  */
191 function getTraceMode(xdcArgs)
193     var trace = new Array();
195     /* Check for any XDCARGS with profile=; these are profiles. */
196     for (var i = 0; i < xdcArgs.length; i++) {
197         if (xdcArgs[i].match(/trace=/)) {
198             trace.push(xdcArgs[i].substr(6));
199         }
200     }
202     return trace;
205 /*
206  *  ======== getCacheMode ========
207  *  Determines which Cache mode to use.
208  *
209  */
210 function getCacheMode(xdcArgs)
212     var cache_wa = new Array();
214     /* Check for any XDCARGS with profile=; these are profiles. */
215     for (var i = 0; i < xdcArgs.length; i++) {
216         if (xdcArgs[i].match(/cache_wa=/)) {
217             cache_wa.push(xdcArgs[i].substr(9));
218         }
219     }
221     return cache_wa;
224 /*
225  *  ======== getSenPositions ========
226  *  Determines which Cache mode to use.
227  *
228  */
229 function getSenPositions(xdcArgs)
231     var SenPosition = new Array();
233     /* Check for any XDCARGS with profile=; these are profiles. */
234     for (var i = 0; i < xdcArgs.length; i++) {
235         if (xdcArgs[i].match(/SenPosition=/)) {
236             SenPosition.push(xdcArgs[i].substr(12));
237         }
238     }
240     return SenPosition;
243 // Possible options - none Virtio
244 // ISS_SIMULATOR
245 // VIRTIO
246 // ...
247 function getTargetEnvironment(xdcArgs)
249     var target_env = new Array();
251     /* Check for any XDCARGS with profile=; these are profiles. */
252     for (var i = 0; i < xdcArgs.length; i++) {
253         if (xdcArgs[i].match(/target_env=/)) {
254             target_env.push(xdcArgs[i].substr(11));
255         }
256     }
257     return target_env;
260 /*
261  *  ======== getTargetBuild ========
262  *  Determines which build to use.
263  *
264  */
265 function getTargetBuild(xdcArgs)
267     var build = "";
269     /* Check for any XDCARGS with target_build= */
270     for (var i = 0; i < xdcArgs.length; i++) {
271         if (xdcArgs[i].match(/target_build=/)) {
272             build = xdcArgs[i].substr(13);
273         }
274     }
276     return build;
279 /*
280  *  ======== getHwType ========
281  *  Determines which OMAP version to use.
282  *
283  */
284 function getHwType(xdcArgs)
286     var omap_version="OMAP4"; //Setting default values
288     /* Check for any XDCARGS with hw_type=; these are the corenames */
289     for (var i = 0; i < xdcArgs.length; i++) {
290         if (xdcArgs[i].match(/hw_type=/)) {
291             // [1] operation is used on the return value of split(), which
292             // is an array.
293             var omap_version = xdcArgs[i].split("=")[1];
294         }
295     }
297     return omap_version;
301 /*
302  *  ======== isSmpBios ========
303  *  Determines which type of BIOS is used - SMP or non-SMP.
304  *
305  */
306 function isSmpBios(xdcArgs)
308     var SMPmode = false; //Setting default value to non-SMP
309     var bios_type = "";
311     /* Check for any XDCARGS with BIOS_type=; this tells us if BIOS is SMP or not  */
312     for (var i = 0; i < xdcArgs.length; i++) {
313         if (xdcArgs[i].match(/BIOS_type=/)) {
314             // [1] operation is used on the return value of split(), which
315             // is an array.
316             var bios_type = xdcArgs[i].split("=")[1];
317         }
318     }
320     if (bios_type == "SMP")
321     {
322         SMPmode = true;
323     }
325     return SMPmode;
329 /*
330  *  ======== getGitTag ========
331  *  Determines TAG.
332  *
333  */
334 function getGitTag(xdcArgs)
336     var git_tag = "";
337     /* Check for any XDCARGS with git_tag= */
338     for (var i = 0; i < xdcArgs.length; i++) {
340         if (xdcArgs[i].match(/git_tag=/)) {
341            git_tag = xdcArgs[i].substr(8);
342            print("i " + i + "\n");
343         }
344     }
345     return git_tag;
348 /*
349  *  ======== getBoardConfig ========
350  *  Determines which board config to use.
351  *
352  */
353 function getBoardConfig(xdcArgs)
355     var board = "";
357     /* Check for any XDCARGS with board_config= */
358     for (var i = 0; i < xdcArgs.length; i++) {
359         if (xdcArgs[i].match(/board_config=/)) {
360             board = xdcArgs[i].substr(13);
361         }
362     }
364     if(board.length ==0)
365      board = 'BOARD_CONFIG_TI_BLAZE'
367     print("!!!!Configuring for board " + board);
369     return board;
372 /*
373  *  ======== getGitCommitID ========
374  *  Determines commit ID.
375  *
376  */
377 function getGitCommitID(xdcArgs)
379     var commit_id = "";
381     /* Check for any XDCARGS with git_commit_id= */
382     for (var i = 0; i < xdcArgs.length; i++) {
383         if (xdcArgs[i].match(/git_commit_id=/)) {
384             commit_id = xdcArgs[i].substr(14);
385         }
386     }
387     print ("commit_id::: " + commit_id +"\n");
388     return commit_id;
391 /*
392  *  ======== getGitBranch ========
393  *  Determines commit ID.
394  *
395  */
396 function getGitBranch(xdcArgs)
398     var branch = "";
399     /* Check for any XDCARGS with git_branch= */
400     for (var i = 0; i < xdcArgs.length; i++) {
401         if (xdcArgs[i].match(/git_branch=/)) {
402             branch = xdcArgs[i].substr(11);
403         }
404     }
405     return branch;
409 /*
410  *  ======== commonGetVersion ========
411  *  Common commonGetVersion function
412  */
413 function GetVersionTag()
415   var exitCode = 1;
416   var verFlags = "";
417   status = {};
418   var verInfo;
419   var git_cmd = "git ";
420   var ipc_ver = " IPC 3_43_03_05 ";
421   var ipumm_ver = " MMIP 3_00_12_00 ";
423   var type_cmd = "type ";
424   var flush_cmd = "echo ";
426   Program.global.ducati_ver_commit_id = "";
427   Program.global.ducati_ver_branch = "local";
428   ipumm_ver += ipc_ver;
429   Program.global.ducati_ver_tag = ipumm_ver;
430   Program.global.ducati_ver_h264d = "H264D-02.00.21.01";
431   Program.global.ducati_ver_mpeg4d = "MPEG4D-01.00.15.01";
432   Program.global.ducati_ver_mpeg2d = "MPEG2D-01.00.17.01";
433   Program.global.ducati_ver_vc1d = "VC1D-01.00.02.05";
434   Program.global.ducati_ver_mjpegd = "MJPEGD-01.00.16.01";
435   Program.global.ducati_ver_mjpege = "MJPEGE-01.00.17.01";
436   Program.global.ducati_ver_h264e = "H264E-02.00.09.01";
437   Program.global.ducati_ver_mpeg4e = "MPEG4E-01.00.02.01";
440   /*Check the target environment */
441   var host_env =environment["user.dir"];
442   if(host_env[1] == ':')
443   {
444     git_cmd = "git.exe "
445     echo_cmd = "c:/windows/system32/cmd /c echo "
446   }
448   //exitCode = xdc.exec(echo_cmd + "dummy write  " + " >> ducati_version.h", {},  status);
451   //branch
453   exitCode = xdc.exec(git_cmd + "branch -a", {},  status)
454   if (exitCode == -1)
455   {
456     print("Version Information not Generated \n");
457     return;
458   }
459   var lines = status.output.split('\n')
460   for (var i = 0; i < lines.length - 1; i++) {
461     var line = lines[i];
463     if(line.indexOf('*')!=-1){
464       var GitBranch = line.substr(2)
465       if (GitBranch.length) {
466             Program.global.ducati_ver_branch = GitBranch;
467             //exitCode = xdc.exec(echo_cmd + "#define GIT_BRANCH_VER  " + "\""+ GitBranch + "\"" + " > ducati_version.h", {},  status);
468             //verFlags += " -DGIT_BRANCH=\\\""+GitBranch+"\\\" "
470           }
471       }
472   }
474   //commit-id
475   exitCode = xdc.exec(git_cmd + "log --oneline", {},  status)
476   if (exitCode == -1) return verFlags;
477   var lines = status.output.split('\n')
478   var GitCommitId  = lines[0].substr(0,7)
479   if (GitCommitId.length)
480   {
481     Program.global.ducati_ver_commit_id = GitCommitId;
482      //exitCode = xdc.exec(echo_cmd + "#define GIT_COMMIT_ID_VER  " + "\""+ GitCommitId + "\""+ " >> ducati_version.h", {},  status);
485     //verFlags += " -DGIT_COMMIT_ID=\\\""+GitCommitId+"\\\" "
486     //print (verFlags)
487   }
489   //tag
490   exitcode = xdc.exec(git_cmd + "describe", {},  status)
491   if (exitCode == -1) return verFlags;
492   var lines = status.output.split('\n')
493   var tail_pos = lines.length
494   var GitTag = lines[0]
495   var MMIPtag = "MMIP " + GitTag + ipc_ver;
496   if (GitTag.length) {
498      //exitCode = xdc.exec(echo_cmd + "#define GIT_TAG_VER " + "\""+ GitTag + "\""+ " >> ducati_version.h", {},  status);
499     Program.global.ducati_ver_tag=MMIPtag;
500     //verFlags += " -DGIT_TAG=\\\""+GitTag+"\\\" "
501     print ("gittag" + GitTag + Program.global.ducati_ver_tag);
503   }
506   //codec
507     var h264d="", mpeg4d="", vc1d="", mpeg2d="", mpeg4e="", h264e="", mjpege="";
508     var codecFlags="";
510   for (var i = 0; i < lines.length - 1; i++) {
511     var line = lines[i];
512     var tail_pos = line.length
513     var CodecVersion = line.substr(tail_pos -11, 11);
514     //print(line + "\n");
516     /* First Occurance only */
517     if(h264d.length==0){
518         if(line.indexOf('codec-library H264D')!=-1){
519              if (CodecVersion.length) {
520                  //print(CodecVersion );
521               h264d += "H264D-"+CodecVersion
522               //exitCode = xdc.exec(echo_cmd + "#define VER_H264D " + "\""+ CodecVersion + "\""+ " >> ducati_version.h", {},  status);
523               Program.global.ducati_ver_h264d = h264d;
524            }
525            //codecFlags+= h264d
526            //print("\n  " + codecFlags);
527         }
528     }
530     if(mpeg4d.length==0){
531         if(line.indexOf('codec-library MPEG4D')!=-1){
532              if (CodecVersion.length) {
533               mpeg4d += "MPEG4D-"+CodecVersion
534                   //          exitCode = xdc.exec(echo_cmd + "#define VER_MPEG4D " + "\""+ CodecVersion + "\""+ " >> ducati_version.h", {},  status);
535                   Program.global.ducati_ver_mpeg4d = mpeg4d;
536            }
537            //print("\n  " + mpeg4d);
538         }
539     }
541     if(mpeg2d.length==0){
542         if(line.indexOf('codec-library MPEG2D')!=-1){
543              if (CodecVersion.length) {
544               mpeg2d += "MPEG2D-"+CodecVersion
545               //print("MPEG2 Codec ver  \n" + CodecVersion + "line " + line + "line2" + lines[i+1]);
546               //exitCode = xdc.exec(echo_cmd + "#define VER_MPEG2D "  + "\""+ CodecVersion + "\""+ " >> ducati_version.h", {},  status);
547               Program.global.ducati_ver_mpeg2d = mpeg2d;
548            }
549            //print("\n  " + mpeg2d);
550         }
551     }
554     if(vc1d.length==0){
555         if(line.indexOf('codec-library VC1D')!=-1){
556              if (CodecVersion.length) {
557               vc1d += "VC1D-"+CodecVersion
558               //exitCode = xdc.exec(echo_cmd + "#define VER_VC1D "  + "\""+ CodecVersion + "\""+ " >> ducati_version.h", {},  status);
559               Program.global.ducati_ver_vc1d = vc1d;
560            }
561            //print("\n  " + vc1d);
562         }
563     }
566     if(h264e.length==0){
567         if(line.indexOf('codec-library H264E')!=-1){
568              if (CodecVersion.length) {
569               h264e += "H264E-"+CodecVersion
570              //exitCode = xdc.exec(echo_cmd + "#define VER_H264E "  + "\""+ CodecVersion+ "\"" + " >> ducati_version.h", {},  status);
571              Program.global.ducati_ver_h264e = h264e;
572            }
573            //print("\n  " + h264e);
574         }
575     }
578     if(mpeg4e.length==0){
579         if(line.indexOf('codec-library MPEG4E')!=-1){
580              if (CodecVersion.length) {
581               mpeg4e += "MPEG4E-"+CodecVersion
582               //exitCode = xdc.exec(echo_cmd + "#define VER_MPEG4E " + "\""+ CodecVersion+ "\"" + " >> ducati_version.h", {},  status);
583               Program.global.ducati_ver_mpeg4e= mpeg4e;
584            }
585            //print("\n  " + mpeg4e);
586         }
587     }
589     if(mjpege.length==0){
590         if(line.indexOf('codec-library MJPEGE')!=-1){
591              if (CodecVersion.length) {
592               mjpege += "MJPEGE-"+CodecVersion
593               //exitCode = xdc.exec(echo_cmd + "#define VER_MJPEGE " + "\""+ CodecVersion+ "\"" + " >> ducati_version.h", {},  status);
594               Program.global.ducati_ver_mjpege= mjpege;
595            }
596            //print("\n  " + mjpege);
597         }
598     }
600   }
601   //codecFlags= h264d+mpeg4d+vc1d+mpeg2d+mpeg4e+h264e+mjpege;
602   //print("\n Codec Flags" + codecFlags);
603   //if(codecFlags.length){
604     //exitCode = xdc.exec(echo_cmd + "CODEC FLAGS " + codecFlags + " >> ducati_version.h", {},  status);
605     //verFlags += " -DCODEC_LIB_VERSION=\\\""+codecFlags+"\\\" "
607   //}
610     //return verFlags;
614 /*
615  *  ======== getI2cAllowChan0========
616  *  Determines whether usage of i2c
617  *  channel 0 will be permitted
618  *
619  */
620 function getI2cAllowChan0(xdcArgs)
622     var chan0_allow = "";
624     /* Check for any XDCARGS with target_build= */
625     for (var i = 0; i < xdcArgs.length; i++) {
626         if (xdcArgs[i].match(/i2c_allow_chan0=/)) {
627             chan0_allow = xdcArgs[i].substr(16);
628         }
629     }
631     return chan0_allow;
634 /*
635  *  ======== getAllowOffloading ========
636  *  Determines if offloading support is enabled
637  *  in sysm3
638  *
639  */
640 function getAllowOffloading(xdcArgs)
642     var allow = "0";
644     /* Check for any XDCARGS with offloading_allow= */
645     for (var i = 0; i < xdcArgs.length; i++) {
646         if (xdcArgs[i].match(/offloading_allow=/)) {
647             allow = xdcArgs[i].substr(17);
648             if (allow.length == 0) {
649                 allow = "0";
650             }
651         }
652     }
654     return allow;
658 function buildOptions(xdcArgs, aCompileOpts, coreName)
660     var buildMode = new Array();
662     var buildMode = getBuildModes(xdcArgs);
664     var compileOpts = " -D_DM270  -D_DM290_IMX_MCFIX_ ";
666     if (aCompileOpts != null){
667         compileOpts += aCompileOpts;
668     }
670     /*Update compile opt if trace is uart*/
671     var traceMode = getTraceMode(xdcArgs);
672     if(traceMode.length != 0)
673     {
674         if(traceMode[0].match("UART"))
675         {
676             compileOpts += " -DUART_TRACES ";
677         }
678     }
680     /*Update compile opt if use cache or not */
681     var cacheMode = getCacheMode(xdcArgs);
682     if(cacheMode.length != 0)
683     {
684         if(cacheMode[0].match("NEWWA"))
685         {
686             compileOpts += " -DNEW_USE_CACHE ";
687             compileOpts += " -DUSE_CACHE ";
688         }
689         if(cacheMode[0].match("OLDWA"))
690         {
691             compileOpts += " -DOLD_USE_CACHE ";
692             compileOpts += " -DUSE_CACHE ";
693         }
694     }
696     /* update the build flag based on configurAtions */
697     for (var j = 0; j < buildMode.length; j++) {
699         if(buildMode[j].match("TESTCOMPONENTS")) {
700             compileOpts += " -DTESTCOMPONENTS=1 ";
701         }
703         if(buildMode[j].match("VIDEOCOMPONENTS")) {
704             compileOpts += " -DVIDEOCOMPONENTS=1 ";
705         }
707         if(buildMode[j].match("ISSCOMPONENTS")) {
708             compileOpts += " -DISSCOMPONENTS=1 ";
709         }
711         if(buildMode[j].match("DRIVERCOMPONENTS")) {
712             compileOpts += " -DDRIVERCOMPONENTS=1 ";
713         }
714     }
717     /*Update compile opt if use cache or not */
718     var SenPosition = getSenPositions(xdcArgs);
719     if(SenPosition.length != 0)
720     {
721         if(SenPosition[0].match("TABLET"))
722         {
723             compileOpts += " -DTABLET_SEN_POSITION ";
724         }
726         if(SenPosition[0].match("SDP"))
727         {
728             compileOpts += " -DSDP_SEN_POSITION ";
729         }
730         if(SenPosition[0].match("BLAZE"))
731         {
732             compileOpts += " -DBLAZE_SEN_POSITION ";
733         }
734     }
737     if (buildMode.length == 0) {
738         compileOpts += " -DDRIVERCOMPONENTS=1 -DISSCOMPONENTS=1 -DVIDEOCOMPONENTS=1 -DTESTCOMPONENTS=1 ";
739     }
741     if(coreName != null) {
742         if(coreName.match(/sys_m3/)){
743             compileOpts += " -DDUCATI_SYS_M3 ";
744         }
746         if(coreName.match(/app_m3/)){
747             compileOpts += " -DDUCATI_APP_M3 ";
748         }
749     }
751     var I2cAllowChan0 = getI2cAllowChan0(xdcArgs);
752     if(I2cAllowChan0.length != 0)
753     {
754         if(I2cAllowChan0[0].match("1"))
755         {
756             compileOpts += " -DI2C_ID0_WORKS_ON_APP_CORE_PATCH ";
757         }
758     }
760     var AllowOffloading = getAllowOffloading(xdcArgs);
761     if(AllowOffloading[0].match("1")) {
762         compileOpts += " -DOFFLOAD_SUPPORT ";
763     }
765     return compileOpts;
770 /*
771  *  ======== buildLibs ========
772  *  This function generates the makefile goals for the libraries taking
773  *  into account the profile variants, specific ducati cores and build modes
774  *
775  */
776 function buildLibs(objList, trgList, xdcArgs, libCompileOpts, coreName)
778     var compileOpts = buildOptions(xdcArgs, libCompileOpts, coreName);
779     var profiles = getProfiles(xdcArgs);
780     //print ("profile length" + profiles.length +"\t" + "profile0" +  profiles[0] +"\n");
781     /* If no profiles were assigned, build for  whole program debug */
782     if (profiles.length == 0) {
783         profiles[0] = "whole_program_debug";
784     }
786     for (var i = 0; i < Build.targets.length; i++) {
788         var targ = Build.targets[i];
790         for (var j = 0; j < profiles.length; j++) {
792             var profile         = profiles[j];
793             var profileOpts     = compileOpts;
795             if (profile.match(/release/)) {
796                 profileOpts += " -O3";
797             }
799             if (coreName == null) {
800                 var lib_name = 'lib/' + profile + '/' + Pkg.name ;
801             }
802             else {
803                 var lib_name = 'lib/' + coreName + '/' + profile + '/' + Pkg.name ;
804             }
806             var lib = Pkg.addLibrary(lib_name, targ, {profile: profile, copts: profileOpts});
808             lib.addObjects(objList);
809         }
810     }
813 /*
814  *  ======== buildLibsByName ========
815  *  This function generates the makefile goals for the libraries taking
816  *  into account the profile variants, specific ducati cores and build
817  *  modes. The output library name can be specified by user.
818  *
819  */
820 function buildLibsByName(objList, trgList, xdcArgs, libCompileOpts, coreName, name)
822     var compileOpts = buildOptions(xdcArgs, libCompileOpts, coreName);
823     var profiles = getProfiles(xdcArgs);
824     //print ("profile length" + profiles.length +"\t" + "profile0" +  profiles[0] +"\n");
825     /* If no profiles were assigned, build for  whole program debug */
826     if (profiles.length == 0) {
827         profiles[0] = "whole_program_debug";
828     }
830     for (var i = 0; i < Build.targets.length; i++) {
832         var targ = Build.targets[i];
834         for (var j = 0; j < profiles.length; j++) {
836             var profile         = profiles[j];
837             var profileOpts     = compileOpts;
839             if (profile.match(/release/)) {
840                 profileOpts += " -O3";
841             }
843             if (coreName == null) {
844                 var lib_name = 'lib/' + profile + '/' + name ;
845             }
846             else {
847                 var lib_name = 'lib/' + coreName + '/' + profile + '/' + name ;
848             }
850             var lib = Pkg.addLibrary(lib_name, targ, {profile: profile, copts: profileOpts});
852             lib.addObjects(objList);
853         }
854     }
857 /*
858  *  ======== supportsCore ========
859  *  Returns true if coreName is in the supported core list. If coreNameList
860  *  is null or empty, that's taken to mean all targets are supported.
861  */
862 function supportsCore(coreName, coreNameList)
864     if ((coreNameList == null) || (coreNameList.length == 0)) {
865         return true;
866     }
868     for (var j = 0; j < coreNameList.length; j++) {
869         if(coreName.match(coreNameList[j])){
870             return true;
871         }
872     }
874     return false;
877 /*
878  *  ======== commonGetLibs ========
879  *  Common getLibs function
880  */
882 function commonGetLibs(prog, bCoreFlag, pkg, dir)
884     var suffix;
886     /* find a compatible suffix */
887     if ("findSuffix" in prog.build.target) {
888         suffix = prog.build.target.findSuffix(pkg);
889     }
890     else {
891         suffix = prog.build.target.suffix;
892     }
894     var name = pkg.$name + ".a" + suffix;
895     var lib  = "";
897     if (bCoreFlag == true) {
898         lib = "lib/" + prog.global.coreName + "/" + pkg.profile + "/" + name;
899     }
900     else {
901         lib = "lib/" + "/" + pkg.profile + "/" + name;
902     }
904     if (java.io.File(dir + lib).exists()) {
905         return lib;
906     }
907     else {
908         print("Default lib not found: " + lib +"\nlooking for release lib");
909         if (bCoreFlag == true) {
910           lib = "lib/" + prog.global.coreName + "/" + "release/" + name;
911         }
912         else {
913           lib = "lib/" + "/" + "release/" + name;
914         }
915         if (java.io.File(dir + lib).exists()) {
916             return lib;
917         }
918     }
920     /* could not find any library, throw exception */
921     throw Error("Library not found: " + lib);