1 /*
2 Copyright (c) 2016, 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 Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
60 var Timer = xdc.useModule('ti.sysbios.hal.Timer');
61 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
62 var Task = xdc.useModule('ti.sysbios.knl.Task');
63 var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
64 var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
65 var Load = xdc.useModule('ti.sysbios.utils.Load');
67 var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
68 var UIAEvt = xdc.useModule('ti.uia.events.UIAEvt');
70 xdc.useModule('ti.sdo.utils.MultiProc');
73 /*
74 * ======== IPC Configuration ========
75 */
76 xdc.global.SR0_cacheEnable = true;
77 xdc.global.SrMsmcMem_cacheEnable = true;
78 xdc.global.SrDDr3Mem_cacheEnable = true;
79 xdc.global.SrDDr3_2Mem_cacheEnable = false;
80 xdc.global.procName = "HOST";
81 var ipc_cfg = xdc.loadCapsule("C:/ti/processor_audio_sdk_1_00_00_00/pasdk/shared/ipc.cfg.xs");
83 /* select ipc libraries */
84 var Build = xdc.useModule('ti.sdo.ipc.Build');
85 Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
86 Build.assertsEnabled = (RB ? false : true);
87 Build.logsEnabled = (RB ? false : true);
90 /*
91 * Uncomment this line to globally disable Asserts.
92 * All modules inherit the default from the 'Defaults' module. You
93 * can override these defaults on a per-module basis using Module.common$.
94 * Disabling Asserts will save code space and improve runtime performance.
95 Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
96 */
98 /*
99 * Uncomment this line to keep module names from being loaded on the target.
100 * The module name strings are placed in the .const section. Setting this
101 * parameter to false will save space in the .const section. Error and
102 * Assert messages will contain an "unknown module" prefix instead
103 * of the actual module name.
104 Defaults.common$.namedModule = false;
105 */
107 /*
108 * Minimize exit handler array in System. The System module includes
109 * an array of functions that are registered with System_atexit() to be
110 * called by System_exit().
111 */
112 System.maxAtexitHandlers = 4;
114 /*
115 * Uncomment this line to disable the Error print function.
116 * We lose error information when this is disabled since the errors are
117 * not printed. Disabling the raiseHook will save some code space if
118 * your app is not using System_printf() since the Error_print() function
119 * calls System_printf().
120 Error.raiseHook = null;
121 */
123 /*
124 * Uncomment this line to keep Error, Assert, and Log strings from being
125 * loaded on the target. These strings are placed in the .const section.
126 * Setting this parameter to false will save space in the .const section.
127 * Error, Assert and Log message will print raw ids and args instead of
128 * a formatted message.
129 Text.isLoaded = false;
130 */
132 /*
133 * Uncomment this line to disable the output of characters by SysMin
134 * when the program exits. SysMin writes characters to a circular buffer.
135 * This buffer can be viewed using the SysMin Output view in ROV.
136 SysMin.flushAtExit = false;
137 */
139 /*
140 * The BIOS module will create the default heap for the system.
141 * Specify the size of this default heap.
142 */
143 //BIOS.heapSize = 0x1000; // initial setting
144 BIOS.heapSize = 0x2000; // from pa.cfg
145 BIOS.heapSection = ".systemHeap";
146 Program.sectMap[".systemHeap"] = "HOST_DDR3";
148 if (xdc.global.SrDDr3_2Mem_cacheEnable == false)
149 {
150 // Disable cache on ARM for the shared memory region
151 var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu');
153 // descriptor attribute structure
154 var attrs = new Mmu.DescriptorAttrs();
156 // Note: If running in SMP mode, all page table entries for memory
157 // shared between the SMP cores should mark the memory as
158 // inner-shareable. This is to ensure that the cached copy of
159 // the memory region is kept coherent accross cores.
161 Mmu.initDescAttrsMeta(attrs);
162 attrs.type = Mmu.DescriptorType_BLOCK; // BLOCK descriptor
163 attrs.shareable = 2; //3; // 2 - outer-sharerable
164 attrs.attrIndx = 0;//2; // MAIR0 Byte2 describes
165 // memory attributes for
166 // this level2 entry
168 // write memory region attribute in mairRegAttr[2] i.e. MAIR0 Reg Byte2
169 Mmu.setMAIRMeta(0, 0x44); // Mark mem regions as non-cacheable
171 /* Get a handle to the C64P Target */
172 // TODO: remove hardcoded address and get correct values from .bld
173 var COMMON2_DDR3_base = 0x81000000;
174 var COMMON2_DDR3_end = 0x81000000 + 0x01000000;
175 // Set the descriptor for each entry in the address range
176 for (var i=COMMON2_DDR3_base; i < COMMON2_DDR3_end; i = i + 0x00200000) {
177 // Each 'BLOCK' descriptor entry spans a 2MB address range
178 Mmu.setSecondLevelDescMeta(i, i, attrs);
179 }
180 }
182 /*
183 * Build a custom SYS/BIOS library from sources.
184 */
185 BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
186 // BIOS.libType = BIOS.LibType_Custom;
187 // BIOS.libType = BIOS.LibType_Debug;
189 /* System stack size (used by ISRs and Swis) */
190 Program.stack = 0x2000;
191 Program.sectMap[".stack"] = "HOST_MSMC";
193 /* Circular buffer size for System_printf() */
194 SysMin.bufSize = 0x200;
196 System.SupportProxy = SysMin;
198 /* ------ */
199 /* Set CPU frequency to 600 MHz */
200 BIOS.cpuFreq.lo = 600000000;
201 BIOS.cpuFreq.hi = 0;
203 /* Set Sysclock period (usec.) */
204 Clock.tickPeriod = 1000; // FL: measured period ~852 usec.??
206 /* Configure Logging */
207 LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
208 LoggingSetup.sysbiosTaskLogging = false; //true;
209 LoggingSetup.sysbiosSwiLogging = false; // no Swi's in system
210 LoggingSetup.sysbiosHwiLogging = false; //true;
211 //LoggingSetup.sysbiosLoggerSize = 16384;
212 LoggingSetup.loadLogging = false; //true;
213 LoggingSetup.mainLogging = true; // false;
214 LoggingSetup.mainLoggingRuntimeControl = false;
215 LoggingSetup.mainLoggerSize = 81960;
216 //LoggingSetup.memorySectionName = "HOST_DDR3"; //"HOST_MSMC";
219 /* Configure Load Logging */ // FL: doesn't work
220 //Load.taskEnabled = true;
221 //Load.hwiEnabled = true;
222 //Load.common$.diags_USER4 = Diags.ALWAYS_ON;
224 //Task.common$.diags_USER1 = Diags.ALWAYS_ON;
225 Task.common$.diags_INFO = Diags.ALWAYS_ON;
227 /* Disallow nested hardware interrupts */
228 Hwi.dispatcherAutoNestingSupport = false;
230 var ProjName = environment["ProjName"];
231 var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1");
232 var AudioClockSim = environment["AudioClockSim"];
233 var acSimBuild = (AudioClockSim == "1" ? true : false);
235 if (acSimBuild == true)
236 {
237 //
238 // IPC simulation
239 //
241 /* Add timer to simulate Rx audio IPC message */
242 var timer0Params = new Timer.Params();
243 timer0Params.instance.name = "timerRxAudio";
244 timer0Params.period = 5330;
245 timer0Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
246 Program.global.timerRxAudio = Timer.create(1, null, timer0Params);
248 /* Add timer to simulate Tx audio IPC message */
249 var timer1Params = new Timer.Params();
250 timer1Params.instance.name = "timerTxAudio";
251 timer1Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
252 timer1Params.period = 5330;
253 Program.global.timerTxAudio = Timer.create(2, null, timer1Params);
255 /* Add semaphore for Rx audio DMA */
256 var semaphore0Params = new Semaphore.Params();
257 semaphore0Params.instance.name = "semaphoreRxAudio";
258 Program.global.semaphoreRxAudio = Semaphore.create(null, semaphore0Params);
260 /* Add semaphore for Tx audio DMA */
261 var semaphore1Params = new Semaphore.Params();
262 semaphore1Params.instance.name = "semaphoreTxAudio";
263 Program.global.semaphoreTxAudio = Semaphore.create(null, semaphore1Params);
264 }
266 /* Set default stack size for tasks */
267 Task.defaultStackSize = 2048;
269 /* Set size of idle task stack */
270 Task.idleTaskStackSize = 2048;
272 /* Add Audio Stream Decode Processing (ASDP) task */
273 var task0Params = new Task.Params();
274 task0Params.instance.name = "TaskAsdp";
275 task0Params.stackSize = 0x4000;
276 task0Params.stackSection = ".far:taskStackSectionAsdp";
277 //task0Params.arg0 = 0;
278 task0Params.arg0 = $externPtr("asdp_params_PA" + topo);
279 task0Params.arg1 = $externPtr("asdp_patchs_PA" + topo);
280 task0Params.priority = -1; //3;
281 Program.global.TaskAsdp = Task.create("&taskAsdpFxn", task0Params);
282 Program.sectMap[".far:taskStackSectionAsdp"] = "HOST_MSMC";
284 /* Add System Initialization task */
285 var task1Params = new Task.Params();
286 task1Params.instance.name = "TaskSysInit";
287 task1Params.stackSize = 0x1000;
288 task1Params.stackSection = ".far:taskStackSectionSysInit";
289 task1Params.priority = 4;
290 Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task1Params);
291 Program.sectMap[".far:taskStackSectionSysInit"] = "HOST_DDR3";
293 Program.sectMap[".far:taskStackSection"] = "HOST_DDR3"; // SDRAM in pa.cfg
295 // Dec ip circular buffer will be in MSMC, size~=180 kB.
296 // Dec op circular buffer will be in MSMC, size~=192 kB.
297 // However, both buffers will be in Shared Region MSMC.
298 // So this is heap is for other use local to ARM (e.g. Dec chain). Set to 128 kB for now.
299 /* Add MSMC SRAM heap */ // formerly L3RAM
300 var heapMem1Params = new HeapMem.Params();
301 heapMem1Params.instance.name = "heapMemMsmcSram";
302 heapMem1Params.size = 224*1024; //128*1024
303 heapMem1Params.sectionName = ".msmcSramHeap";
304 Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params);
305 Program.sectMap[".msmcSramHeap"] = "HOST_MSMC";
307 /* Add DDR3 heap */ // formerly SDRAM
308 var heapMem2Params = new HeapMem.Params();
309 heapMem2Params.instance.name = "heapMemDdr3";
310 heapMem2Params.size = 4350528;
311 heapMem2Params.sectionName = ".ddr3Heap";
312 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
313 Program.sectMap[".ddr3Heap"] = "HOST_DDR3";
315 Program.global.heapMemL2Sram = Program.global.heapMemMsmcSram;
317 //Program.sectMap[".globalSectionPafAstConfig"] = "COMMON_DDR3";
318 //Program.sectMap[".globalSectionAcpStdBetaTable"] = "COMMON_DDR3";