18e3294b669ba5b3347e55a701c4f3ee9b70127f
1 /*
2 Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
3 All rights reserved.
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
15 * distribution.
16 *
17 * Neither the name of Texas Instruments Incorporated nor the names of
18 * its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
36 /*
37 * ======== app.cfg ========
38 * Platform: 66AK2G_bios_elf
39 * Target: gnu.targets.arm.A15F
40 */
42 /* root of the configuration object model */
43 var Program = xdc.useModule('xdc.cfg.Program');
44 var cfgArgs = Program.build.cfgArgs;
45 var RB = (cfgArgs.profile == "release" ? true : false);
47 /* application uses the following modules and packages */
48 var Defaults = xdc.useModule('xdc.runtime.Defaults');
49 var Diags = xdc.useModule('xdc.runtime.Diags');
50 var Error = xdc.useModule('xdc.runtime.Error');
51 var Log = xdc.useModule('xdc.runtime.Log');
52 var Main = xdc.useModule('xdc.runtime.Main');
53 var Memory = xdc.useModule('xdc.runtime.Memory')
54 var SysMin = xdc.useModule('xdc.runtime.SysMin');
55 var System = xdc.useModule('xdc.runtime.System');
56 var Text = xdc.useModule('xdc.runtime.Text');
58 var BIOS = xdc.useModule('ti.sysbios.BIOS');
59 var GateAll = xdc.useModule('ti.sysbios.gates.GateAll'); // Added for PFP
60 var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
61 var Timer = xdc.useModule('ti.sysbios.hal.Timer');
62 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
63 var Idle = xdc.useModule('ti.sysbios.knl.Idle');
64 var Swi = xdc.useModule('ti.sysbios.knl.Swi'); // Added for PFP, no SWIs on ARM
65 var Task = xdc.useModule('ti.sysbios.knl.Task');
66 var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
67 var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
68 var Load = xdc.useModule('ti.sysbios.utils.Load');
70 var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
71 var UIAEvt = xdc.useModule('ti.uia.events.UIAEvt');
73 xdc.useModule('ti.sdo.utils.MultiProc');
76 var HsDevBuild = environment["HsDevBuild"];
77 var hsDevBuild = (HsDevBuild == "1" ? true : false);
78 if (hsDevBuild == true)
79 {
80 /* Added per recommendation from CATAPPS-171 */
81 /* HS device build */
82 var gicHwi = xdc.useModule('ti.sysbios.family.arm.gic.Hwi');
83 gicHwi.enableSecureMode = false;
84 gicHwi.BPR = 3;
85 gicHwi.NUM_PRIORITY_BITS = 4;
86 }
88 /*
89 * ======== IPC Configuration ========
90 */
91 xdc.global.SR0_cacheEnable = true;
92 xdc.global.SrMsmcMem_cacheEnable = true;
93 xdc.global.SrDDr3Mem_cacheEnable = true;
94 xdc.global.SrDDr3_2Mem_cacheEnable = false;
95 xdc.global.procName = "HOST";
96 /* var ipc_cfg = xdc.loadCapsule("C:/ti/processor_sdk_audio_1_00_00_06/pasdk/shared/ipc.cfg.xs"); */
97 var ipc_cfg = xdc.loadCapsule("../../shared/ipc.cfg.xs");
99 /* select ipc libraries */
100 var Build = xdc.useModule('ti.sdo.ipc.Build');
101 Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
102 Build.assertsEnabled = (RB ? false : true);
103 Build.logsEnabled = (RB ? false : true);
106 /*
107 * Uncomment this line to globally disable Asserts.
108 * All modules inherit the default from the 'Defaults' module. You
109 * can override these defaults on a per-module basis using Module.common$.
110 * Disabling Asserts will save code space and improve runtime performance.
111 Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
112 */
114 /*
115 * Uncomment this line to keep module names from being loaded on the target.
116 * The module name strings are placed in the .const section. Setting this
117 * parameter to false will save space in the .const section. Error and
118 * Assert messages will contain an "unknown module" prefix instead
119 * of the actual module name.
120 Defaults.common$.namedModule = false;
121 */
123 /*
124 * Minimize exit handler array in System. The System module includes
125 * an array of functions that are registered with System_atexit() to be
126 * called by System_exit().
127 */
128 System.maxAtexitHandlers = 4;
130 /*
131 * Uncomment this line to disable the Error print function.
132 * We lose error information when this is disabled since the errors are
133 * not printed. Disabling the raiseHook will save some code space if
134 * your app is not using System_printf() since the Error_print() function
135 * calls System_printf().
136 Error.raiseHook = null;
137 */
139 /*
140 * Uncomment this line to keep Error, Assert, and Log strings from being
141 * loaded on the target. These strings are placed in the .const section.
142 * Setting this parameter to false will save space in the .const section.
143 * Error, Assert and Log message will print raw ids and args instead of
144 * a formatted message.
145 Text.isLoaded = false;
146 */
148 /*
149 * Uncomment this line to disable the output of characters by SysMin
150 * when the program exits. SysMin writes characters to a circular buffer.
151 * This buffer can be viewed using the SysMin Output view in ROV.
152 SysMin.flushAtExit = false;
153 */
155 /*
156 * The BIOS module will create the default heap for the system.
157 * Specify the size of this default heap.
158 */
159 //BIOS.heapSize = 0x1000; // initial setting
160 BIOS.heapSize = 0x2000; // from pa.cfg
161 BIOS.heapSection = ".systemHeap";
162 Program.sectMap[".systemHeap"] = "HOST_DDR3";
164 if (xdc.global.SrDDr3_2Mem_cacheEnable == false)
165 {
166 // Disable cache on ARM for the shared memory region
167 var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu');
169 // descriptor attribute structure
170 var attrs = new Mmu.DescriptorAttrs();
172 // Note: If running in SMP mode, all page table entries for memory
173 // shared between the SMP cores should mark the memory as
174 // inner-shareable. This is to ensure that the cached copy of
175 // the memory region is kept coherent accross cores.
177 Mmu.initDescAttrsMeta(attrs);
178 attrs.type = Mmu.DescriptorType_BLOCK; // BLOCK descriptor
179 attrs.shareable = 2; //3; // 2 - outer-sharerable
180 attrs.attrIndx = 0;//2; // MAIR0 Byte2 describes
181 // memory attributes for
182 // this level2 entry
184 // write memory region attribute in mairRegAttr[2] i.e. MAIR0 Reg Byte2
185 Mmu.setMAIRMeta(0, 0x44); // Mark mem regions as non-cacheable
187 /* Get a handle to the C64P Target */
188 // TODO: remove hardcoded address and get correct values from .bld
189 var COMMON2_DDR3_base = 0x81000000;
190 var COMMON2_DDR3_end = 0x81000000 + 0x01000000;
191 // Set the descriptor for each entry in the address range
192 for (var i=COMMON2_DDR3_base; i < COMMON2_DDR3_end; i = i + 0x00200000) {
193 // Each 'BLOCK' descriptor entry spans a 2MB address range
194 Mmu.setSecondLevelDescMeta(i, i, attrs);
195 }
196 }
198 /*
199 * Build a custom SYS/BIOS library from sources.
200 */
201 BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
202 // BIOS.libType = BIOS.LibType_Custom;
203 // BIOS.libType = BIOS.LibType_Debug;
205 /* System stack size (used by ISRs and Swis) */
206 Program.stack = 0x2000;
207 Program.sectMap[".stack"] = "HOST_MSMC";
209 /* Circular buffer size for System_printf() */
210 SysMin.bufSize = 0x200;
212 System.SupportProxy = SysMin;
214 /* ------ */
215 /* Set CPU frequency to 600 MHz */
216 BIOS.cpuFreq.lo = 600000000;
217 BIOS.cpuFreq.hi = 0;
219 /* Set Sysclock period (usec.) */
220 Clock.tickPeriod = 1000; // FL: measured period ~852 usec.??
222 /* Configure Logging */
223 LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
224 LoggingSetup.sysbiosTaskLogging = false; //true;
225 LoggingSetup.sysbiosSwiLogging = false; // no Swi's in system
226 LoggingSetup.sysbiosHwiLogging = false; //true;
227 //LoggingSetup.sysbiosLoggerSize = 16384;
228 LoggingSetup.loadLogging = false; //true;
229 LoggingSetup.mainLogging = true; // false;
230 LoggingSetup.mainLoggingRuntimeControl = false;
231 LoggingSetup.mainLoggerSize = 81960;
232 //LoggingSetup.memorySectionName = "HOST_DDR3"; //"HOST_MSMC";
235 /* Configure Load Logging */ // FL: doesn't work
236 //Load.taskEnabled = true;
237 //Load.hwiEnabled = true;
238 //Load.common$.diags_USER4 = Diags.ALWAYS_ON;
240 //Task.common$.diags_USER1 = Diags.ALWAYS_ON;
241 Task.common$.diags_INFO = Diags.ALWAYS_ON;
243 /* Disallow nested hardware interrupts */
244 Hwi.dispatcherAutoNestingSupport = false;
246 var ProjName = environment["ProjName"];
247 var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1");
249 /* Set default stack size for tasks */
250 Task.defaultStackSize = 2048;
252 /* Set size of idle task stack */
253 Task.idleTaskStackSize = 2048;
255 /* Add Audio Stream Decode Processing (ASDP) task */
256 var task0Params = new Task.Params();
257 task0Params.instance.name = "TaskAsdp";
258 task0Params.stackSize = (0x8000+0x1000);
259 task0Params.stackSection = ".far:taskStackSectionAsdp";
260 //task0Params.arg0 = 0;
261 task0Params.arg0 = $externPtr("asdp_params_PA" + topo);
262 task0Params.arg1 = $externPtr("asdp_patchs_PA" + topo);
263 task0Params.priority = -1; //3;
264 Program.global.TaskAsdp = Task.create("&taskAsdpFxn", task0Params);
265 Program.sectMap[".far:taskStackSectionAsdp"] = "HOST_DDR3";
267 /* Add System Initialization task */
268 var task1Params = new Task.Params();
269 task1Params.instance.name = "TaskSysInit";
270 task1Params.stackSize = 0x1000;
271 task1Params.stackSection = ".far:taskStackSectionSysInit";
272 task1Params.priority = 4;
273 Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task1Params);
274 Program.sectMap[".far:taskStackSectionSysInit"] = "HOST_DDR3";
276 Program.sectMap[".far:taskStackSection"] = "HOST_DDR3"; // SDRAM in pa.cfg
278 // Dec ip circular buffer will be in MSMC, size~=180 kB.
279 // Dec op circular buffer will be in MSMC, size~=192 kB.
280 // However, both buffers will be in Shared Region MSMC.
281 // So this is heap is for other use local to ARM (e.g. Dec chain). Set to 128 kB for now.
282 /* Add MSMC SRAM heap */ // formerly L3RAM
283 var heapMem1Params = new HeapMem.Params();
284 heapMem1Params.instance.name = "heapMemMsmcSram";
285 //heapMem1Params.size = (224-4)*1024; //128*1024
286 heapMem1Params.size = 192*1024; //128*1024
287 heapMem1Params.sectionName = ".msmcSramHeap";
288 Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params);
289 Program.sectMap[".msmcSramHeap"] = "HOST_MSMC";
291 /* Add DDR3 heap */ // formerly SDRAM
292 var heapMem2Params = new HeapMem.Params();
293 heapMem2Params.instance.name = "heapMemDdr3";
294 heapMem2Params.size = 5350528+ (3*1024*1024); // Added 3 MB for DTS decoder;//4350528;
295 heapMem2Params.sectionName = ".ddr3Heap";
296 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
297 Program.sectMap[".ddr3Heap"] = "HOST_DDR3";
299 Program.global.heapMemL2Sram = Program.global.heapMemMsmcSram;
301 //Program.sectMap[".globalSectionPafAstConfig"] = "COMMON_DDR3";
302 //Program.sectMap[".globalSectionAcpStdBetaTable"] = "COMMON_DDR3";
304 /* Define HWI Hook Set for PFP */
305 Hwi.addHookSet({
306 registerFxn: '&pfpHwiRegister',
307 createFxn: '&pfpHwiCreate',
308 beginFxn: '&pfpHwiBegin',
309 endFxn: '&pfpHwiEnd',
310 deleteFxn: null,
311 });
313 /* Define SWI Hook Set for PFP */
314 Swi.addHookSet({
315 registerFxn: '&pfpSwiRegister', // need this for Id for Hook context
316 createFxn: '&pfpSwiCreate', // malloc context storage space
317 readyFxn: '&pfpSwiReady',
318 beginFxn: '&pfpSwiBegin',
319 endFxn: '&pfpSwiEnd',
320 deleteFxn: null,
321 });
323 /* Define Task Hook Set for PFP */
324 Task.addHookSet({
325 registerFxn: '&pfpTaskRegister',
326 createFxn: '&pfpTaskCreate',
327 readyFxn: '&pfpTaskReady',
328 switchFxn: '&pfpTaskSwitch',
329 exitFxn: null,
330 deleteFxn: null,
331 });
333 /* Added for PFP, not necessary */
334 Hwi.common$.namedInstance=true;
335 Swi.common$.namedInstance=true;
336 Task.common$.namedInstance=true;