1 /*
2 * Copyright (c) 2012-2018 Texas Instruments Incorporated - http://www.ti.com
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 */
33 var Memory = xdc.useModule('xdc.runtime.Memory');
34 var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
35 var BIOS = xdc.useModule('ti.sysbios.BIOS');
36 BIOS.heapSize = 0x10000;
37 BIOS.libType = BIOS.LibType_Custom;
39 var Task = xdc.useModule('ti.sysbios.knl.Task');
40 Task.deleteTerminatedTasks = true;
42 var Idle = xdc.useModule('ti.sysbios.knl.Idle');
43 Idle.addFunc('&VirtQueue_cacheWb');
45 var System = xdc.useModule('xdc.runtime.System');
46 var SysMin = xdc.useModule('ti.trace.SysMin');
47 System.SupportProxy = SysMin;
49 var Diags = xdc.useModule('xdc.runtime.Diags');
51 xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
53 print ("Program.cpu.deviceName = " + Program.cpu.deviceName);
54 print ("Program.platformName = " + Program.platformName);
55 if (Program.cpu.deviceName == "OMAPL138") {
56 xdc.useModule('ti.ipc.family.omapl138.VirtQueue');
57 xdc.useModule('ti.sdo.ipc.family.da830.InterruptDsp');
59 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
60 MultiProc.setConfig("DSP", ["HOST", "DSP"]);
62 /* Enable Memory Translation module that operates on the Resource Table */
63 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
64 Resource.loadSegment = Program.platform.dataMemory;
66 Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
67 Program.sectMap[".text:_c_int00"].loadSegment = "DDR";
68 Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
70 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
71 Hwi.enableException = true;
73 var Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
74 /* Set 0xc4000000 -> 0xc4ffffff to be non-cached for shared memory IPC */
75 Cache.MAR192_223 = 0x00000010;
77 var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
78 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
79 Timer.timerSettings[1].master = true;
80 Timer.defaultHalf = Timer.Half_LOWER;
81 Clock.timerId = 1;
83 SysMin.bufSize = 0x8000;
84 Program.sectMap[".tracebuf"] = "DDR";
86 /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
87 /*
88 Diags.setMaskMeta("ti.sdo.ipc.family.da830.InterruptDsp", Diags.USER1,
89 Diags.ALWAYS_ON);
90 Diags.setMaskMeta("ti.ipc.family.omapl138.VirtQueue", Diags.USER1,
91 Diags.ALWAYS_ON);
92 Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
93 Diags.INFO|Diags.USER1|Diags.STATUS,
94 Diags.ALWAYS_ON);
95 Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
96 Diags.ALWAYS_ON);
97 */
99 /* Enable runtime Diags_setMask() for non-XDC spec'd modules: */
100 /*
101 var Text = xdc.useModule('xdc.runtime.Text');
102 Text.isLoaded = true;
103 var Registry = xdc.useModule('xdc.runtime.Registry');
104 Registry.common$.diags_INFO = Diags.ALWAYS_ON;
105 Registry.common$.diags_STATUS = Diags.ALWAYS_ON;
106 Registry.common$.diags_LIFECYCLE = Diags.ALWAYS_ON;
107 Diags.setMaskEnabled = true;
108 */
109 }
110 else if (Program.platformName.match(/6614/)) {
111 var VirtQueue = xdc.useModule('ti.ipc.family.tci6614.VirtQueue');
112 var Interrupt = xdc.useModule('ti.ipc.family.tci6614.Interrupt');
114 /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
115 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
116 MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
118 Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
119 Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
120 Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
122 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
123 Hwi.enableException = true;
125 /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
126 We assume the rest is to be left cacheable.
127 Per sprugw0b.pdf
128 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
129 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
130 */
131 var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
132 /* This doesn't work:
133 Cache.MAR160_191 = 0xFFFFFFFC;
134 So, need to do this:
135 */
136 Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
138 Program.global.sysMinBufSize = 0x8000;
139 SysMin.bufSize = Program.global.sysMinBufSize;
141 /* Enable Memory Translation module that operates on the Resource Table */
142 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
143 Resource.loadSegment = Program.platform.dataMemory;
145 /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
146 /*
147 Diags.setMaskMeta("ti.ipc.family.tci6614.Interrupt", Diags.USER1,
148 Diags.ALWAYS_ON);
149 Diags.setMaskMeta("ti.ipc.family.tci6614.VirtQueue", Diags.USER1,
150 Diags.ALWAYS_ON);
151 Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
152 Diags.INFO|Diags.USER1|Diags.STATUS,
153 Diags.ALWAYS_ON);
154 Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
155 Diags.ALWAYS_ON);
156 */
157 }
158 else if (Program.platformName.match(/simKepler/) ||
159 Program.cpu.deviceName.match(/^TMS320C66AK2E05$/) ||
160 Program.cpu.deviceName.match(/^TMS320C66AK2H12$/) ||
161 Program.cpu.deviceName.match(/^TCI66AK2G02$/) ||
162 Program.cpu.deviceName.match(/^TMS320TCI663(0K2L|6|8)$/)) {
163 var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
165 /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
166 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
168 switch (Program.cpu.deviceName) {
169 case "TMS320C66AK2E05":
170 case "TCI66AK2G02":
171 MultiProc.setConfig(null,
172 ["HOST", "CORE0"]);
173 break;
175 case "TMS320TCI6630K2L":
176 MultiProc.setConfig(null,
177 ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
178 break;
180 case "TMS320TCI6636":
181 case "TMS320TCI6638":
182 case "TMS320C66AK2H12":
183 MultiProc.setConfig(null,
184 ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
185 "CORE4", "CORE5", "CORE6", "CORE7"]);
186 break;
187 }
189 Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
190 Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
191 Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
193 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
194 Hwi.enableException = true;
196 /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
197 We assume the rest is to be left cacheable.
198 Per sprugw0b.pdf
199 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
200 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
201 */
202 var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
203 /* This doesn't work:
204 Cache.MAR160_191 = 0xFFFFFFFC;
205 So, need to do this:
206 */
207 /* TBD: Update for Kepler: */
208 Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
210 Program.global.sysMinBufSize = 0x2000;
211 SysMin.bufSize = Program.global.sysMinBufSize;
213 Program.sectMap[".tracebuf"] = "L2SRAM";
215 /* Enable Memory Translation module that operates on the Resource Table */
216 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
217 Resource.loadSegment = Program.platform.dataMemory;
219 /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
220 /*
221 Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
222 Diags.ALWAYS_ON);
223 Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
224 Diags.INFO|Diags.USER1|Diags.STATUS,
225 Diags.ALWAYS_ON);
226 Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
227 Diags.ALWAYS_ON);
228 */
229 }
230 else if (Program.platformName.match(/^ti\.platforms\.cortexR\:AM65X/) &&
231 Program.cpu.attrs.cpuCore.match(/^R5$/)) {
233 print("messageq_common.cfg.xs cpuCore:" + Program.cpu.attrs.cpuCore);
234 var VirtQueue = xdc.useModule('ti.ipc.family.am65xx.VirtQueue');
235 SysMin.bufSize = 0x8000;
236 // Memory.defaultHeapSize = 0x20000;
238 /* Enable Memory Translation module that operates on the Resource Table */
239 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
240 Resource.loadSymbol = "__RESOURCE_TABLE";
242 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
244 xdc.loadPackage('ti.sdo.ipc.family.am65xx');
245 xdc.useModule('ti.sdo.ipc.family.am65xx.InterruptR5f');
246 xdc.loadPackage('ti.ipc.rpmsg');
247 xdc.loadPackage('ti.ipc.family.am65xx');
249 var List = xdc.useModule('ti.sdo.utils.List');
251 xdc.useModule('ti.sysbios.xdcruntime.GateThreadSupport');
252 var GateSwi = xdc.useModule('ti.sysbios.gates.GateSwi');
254 var Hwi = xdc.useModule('ti.sysbios.family.arm.v7r.keystone3.Hwi');
255 /* TODO: Need to check on equivalent for K3 */
256 // Hwi.enableException = true;
258 var Core = xdc.useModule('ti.sysbios.family.arm.v7r.keystone3.Core');
260 var Timer = xdc.module('ti.sysbios.timers.dmtimer.Timer');
261 Timer.checkFrequency = false; /* Disable frequency check */
262 for (var i = 0; i < 4; i++) {
263 Timer.intFreqs[i].lo = 20000000; /* Set a high Timer frequency value
264 as default may be too small and
265 cause frquenct interrupts. */
266 Timer.intFreqs[i].hi = 0;
267 }
269 /* Add idle function */
270 xdc.useModule('ti.sdo.ipc.family.am65xx.Power');
271 Idle.addFunc('&Power_Idle');
272 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
274 if (Program.platformName.match(/^ti\.platforms\.cortexR\:AM65X\:false\:R5F0/)) {
275 xdc.loadCapsule("R5fmpu_am65xx.cfg");
276 MultiProc.setConfig("R5F-0", ["HOST", "R5F-0", "R5F-1"]);
277 Core.id = 0;
278 Clock.timerId = 0;
279 } else if (Program.platformName.match(/^ti\.platforms\.cortexR\:AM65X\:false\:R5F1/)) {
280 xdc.loadCapsule("R5f1_mpu_am65xx.cfg");
281 MultiProc.setConfig("R5F-1", ["HOST", "R5F-0", "R5F-1"]);
282 Core.id = 1;
283 Clock.timerId = 1;
284 }
286 }
287 else {
288 throw("messageq_common.cfg.xs: Did not match any platform!"
289 + " platform:" + Program.platformName + " cpuCore:"
290 + Program.cpu.attrs.cpuCore + " deviceName:"
291 + Program.cpu.deviceName);
292 }
294 xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
295 BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
297 var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
298 var params = new HeapBuf.Params;
299 params.align = 8;
300 params.blockSize = 512;
301 if (Program.cpu.deviceName.match(/^TMS320C66AK2E05$/)) {
302 params.numBlocks = 32;
303 } else {
304 params.numBlocks = 64;
305 }
307 var msgHeap = HeapBuf.create(params);
309 var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
310 MessageQ.registerHeapMeta(msgHeap, 0);
312 var Assert = xdc.useModule('xdc.runtime.Assert');
313 var Defaults = xdc.useModule('xdc.runtime.Defaults');
314 var Text = xdc.useModule('xdc.runtime.Text');
315 Text.isLoaded = true;
317 var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
318 var LoggerSysParams = new LoggerSys.Params();
320 Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
322 var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
323 VirtioSetup.common$.diags_INFO = Diags.RUNTIME_OFF;
325 var Main = xdc.useModule('xdc.runtime.Main');
326 Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
327 Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
329 xdc.loadPackage('ti.ipc.transports').profile = 'release';