[processor-sdk/performance-audio-sr.git] / psdk_cust / pdk_k2g_1_0_1_2_eng / packages / ti / board / src / Module.xs
1 /******************************************************************************
2 * FILE PURPOSE: Module specification file.
3 ******************************************************************************
4 * FILE NAME: module.xs
5 *
6 * DESCRIPTION:
7 * This file contains the module specification to build this XDC package
8 *
9 * Copyright (C) 2009-2015, Texas Instruments, Inc.
10 *****************************************************************************/
12 /* Load the library utility. */
13 var libUtility = xdc.loadCapsule ("../build/buildlib.xs");
15 /**************************************************************************
16 * FUNCTION NAME : buildTarget
17 **************************************************************************/
18 function buildTarget(evm)
19 {
20 var boardName = boards[evm].name;
21 /* Build the libraries for all the targets specified. */
22 for (var targets=0; targets < boards[evm].targets.length; targets++)
23 {
24 /* If building for K2K, use K2H source files */
25 if (boardName.equals("evmK2K"))
26 var files = libUtility.listAllFiles(".c", "src/evmK2H", true);
27 else
28 var files = libUtility.listAllFiles(".c", "src/"+boardName, true);
30 if (java.lang.String(boardName).contains("evmK2") || java.lang.String(boardName).contains("evmC66"))
31 {
32 files[files.length++] = "./src/evmKeystone/board_utils.c";
33 files[files.length++] = "./src/evmKeystone/board_clock.c";
34 files[files.length++] = "./src/evmKeystone/board_lld_init.c";
35 files[files.length++] = "./src/evmKeystone/board_pll.c";
36 }
38 if (java.lang.String(boardName).contains("evmK2G"))
39 {
40 if (java.lang.String(boards[evm].targets[targets].name).contains("66"))
41 {
42 var flash_files = libUtility.listAllFiles(".c", "src/flash", true);
43 for (var ffiles=0; ffiles < flash_files.length; ffiles++)
44 files[files.length++] = flash_files[ffiles];
45 }
46 else
47 {
48 files[files.length++] = "./src/flash/board_flash.c";
49 files[files.length++] = "./src/flash/qspi_nor/s25fl512s/qspi_nor.c";
50 }
51 }
53 if (files == undefined)
54 {
55 print("No source files for ./src/"+boardName);
56 print("Skipping build.");
57 continue;
58 }
59 files[files.length++] = "./src/board.c";
61 /* Additional starterware files if defined */
62 if (boards[evm].stwFiles != undefined)
63 {
64 for (var stwFile = 0; stwFile < boards[evm].stwFiles.length; stwFile++)
65 {
66 files[files.length++] = boards[evm].stwFiles[stwFile];
67 }
68 }
70 /* Additional LLD dependent files if defined */
71 if (boards[evm].lldFiles != undefined)
72 {
73 for (var lldFile = 0; lldFile < boards[evm].lldFiles.length; lldFile++)
74 {
75 files[files.length++] = boards[evm].lldFiles[lldFile];
76 }
77 }
79 var libOptions = {
80 };
82 /* If AM5 and C66, add asm file for IO delay */
83 if (java.lang.String(boardName).contains("AM5") && java.lang.String(boards[evm].targets[targets].name).contains("66"))
84 files[files.length++] = "./src/"+boardName+"/iodelay_stack_C66.asm";
86 /* Build the library */
87 libUtility.buildLibrary (libOptions, Pkg.name, boards[evm], boards[evm].targets[targets], files);
89 }
91 }
93 /**************************************************************************
94 * FUNCTION NAME : modBuild
95 **************************************************************************/
96 function modBuild()
97 {
98 /* First argument is the filename config.bld. If nothing else specified, build everything */
99 if (buildArguments.length == 1)
100 {
101 print("Building for all boards");
102 for (var evm=0; evm < boards.length; evm++)
103 {
104 buildTarget(evm);
105 }
106 }
107 else
108 {
109 for (var xdcArg=1; xdcArg < buildArguments.length; xdcArg++)
110 {
111 for (var evm=0; evm < boards.length; evm++)
112 {
113 var boardName = boards[evm].name;
114 if (boardName.equals(buildArguments[xdcArg]))
115 {
116 print("Building for " + boardName);
117 buildTarget(evm);
118 }
119 }
120 }
121 }
122 /* Add all the .c files to the release package. */
123 var testFiles = libUtility.listAllFiles (".c", "src", true);
124 for (var k = 0 ; k < testFiles.length; k++)
125 Pkg.otherFiles[Pkg.otherFiles.length++] = testFiles[k];
127 /* Add all the .h files to the release package. */
128 var testFiles = libUtility.listAllFiles (".h", "src", true);
129 for (var k = 0 ; k < testFiles.length; k++)
130 Pkg.otherFiles[Pkg.otherFiles.length++] = testFiles[k];
132 /* Add all the .asm files to the release package. */
133 var testFiles = libUtility.listAllFiles (".asm", "src", true);
134 for (var k = 0 ; k < testFiles.length; k++)
135 Pkg.otherFiles[Pkg.otherFiles.length++] = testFiles[k];
136 }