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 /* Reduces code size, by only pulling in modules explicitly referenced: */
38 BIOS.libType = BIOS.LibType_Custom;
40 var Idle = xdc.useModule('ti.sysbios.knl.Idle');
41 Idle.addFunc('&VirtQueue_cacheWb');
43 var System = xdc.useModule('xdc.runtime.System');
44 /* Use ti.trace.SysMin for remoteproc to handle trace as circular buffer */
45 var SysMin = xdc.useModule('ti.trace.SysMin');
46 System.SupportProxy = SysMin;
48 var Diags = xdc.useModule('xdc.runtime.Diags');
50 if (Program.cpu.deviceName == "OMAPL138") {
51 xdc.useModule('ti.ipc.family.omapl138.VirtQueue');
52 xdc.useModule('ti.sdo.ipc.family.da830.InterruptDsp');
54 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
55 MultiProc.setConfig("DSP", ["HOST", "DSP"]);
57 /* Enable Memory Translation module that operates on the Resource Table */
58 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
59 Resource.loadSegment = Program.platform.dataMemory;
61 Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
62 Program.sectMap[".text:_c_int00"].loadSegment = "DDR";
63 Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
65 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
67 var Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
68 /* Set 0xc4000000 -> 0xc4ffffff to be non-cached for shared memory IPC */
69 Cache.MAR192_223 = 0x00000010;
71 Program.global.sysMinBufSize = 0x8000;
72 SysMin.bufSize = Program.global.sysMinBufSize;
74 var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
75 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
76 Timer.timerSettings[1].master = true;
77 Timer.defaultHalf = Timer.Half_LOWER;
78 Clock.timerId = 1;
80 /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
81 /*
82 Diags.setMaskMeta("ti.ipc.family.omapl138.Interrupt", Diags.USER1,
83 Diags.ALWAYS_ON);
84 Diags.setMaskMeta("ti.ipc.family.omapl138.VirtQueue", Diags.USER1,
85 Diags.ALWAYS_ON);
86 */
88 Program.sectMap[".tracebuf"] = "DDR";
89 }
90 else if (Program.platformName.match(/6614/)) {
91 var VirtQueue = xdc.useModule('ti.ipc.family.tci6614.VirtQueue');
92 var Interrupt = xdc.useModule('ti.ipc.family.tci6614.Interrupt');
94 /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
95 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
96 MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
98 Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
99 Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
100 Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
102 Program.sectMap[".tracebuf"] = "DDR";
104 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
106 /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
107 We assume the rest is to be left cacheable.
108 Per sprugw0b.pdf
109 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
110 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
111 */
112 var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
113 /* This doesn't work:
114 Cache.MAR160_191 = 0xFFFFFFFC;
115 So, need to do this:
116 */
117 Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
119 Program.global.sysMinBufSize = 0x8000;
120 SysMin.bufSize = Program.global.sysMinBufSize;
122 /* Enable Memory Translation module that operates on the Resource Table */
123 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
124 Resource.loadSegment = Program.platform.dataMemory;
126 /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
127 /*
128 Diags.setMaskMeta("ti.ipc.family.tci6614.Interrupt", Diags.USER1,
129 Diags.ALWAYS_ON);
130 Diags.setMaskMeta("ti.ipc.family.tci6614.VirtQueue", Diags.USER1,
131 Diags.ALWAYS_ON);
132 Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
133 Diags.INFO|Diags.USER1|Diags.STATUS,
134 Diags.ALWAYS_ON);
135 Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
136 Diags.ALWAYS_ON);
137 */
138 }
139 else if (Program.platformName.match(/simKepler/) ||
140 Program.cpu.deviceName.match(/^TMS320C66AK2E05$/) ||
141 Program.cpu.deviceName.match(/^TCI66AK2G02$/) ||
142 Program.cpu.deviceName.match(/^TMS320C66AK2H12$/) ||
143 Program.cpu.deviceName.match(/^TMS320TCI663(0K2L|6|8)$/)) {
144 var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
146 /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
147 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
149 switch (Program.cpu.deviceName) {
150 case "TMS320C66AK2E05":
151 case "TCI66AK2G02":
152 MultiProc.setConfig(null, ["HOST", "CORE0"]);
153 break;
155 case "TMS320TCI6630K2L":
156 MultiProc.setConfig(null,
157 ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
158 break;
160 case "TMS320TCI6636":
161 case "TMS320TCI6638":
162 case "TMS320C66AK2H12":
163 MultiProc.setConfig(null,
164 ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
165 "CORE4", "CORE5", "CORE6", "CORE7"]);
166 break;
167 }
169 Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
170 Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
171 Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
173 Program.sectMap[".tracebuf"] = "L2SRAM";
175 var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
177 /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
178 We assume the rest is to be left cacheable.
179 Per sprugw0b.pdf
180 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
181 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
182 */
183 var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
184 /* This doesn't work:
185 Cache.MAR160_191 = 0xFFFFFFFC;
186 So, need to do this:
187 */
188 /* TBD: Update for Kepler: */
189 Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
191 Program.global.sysMinBufSize = 0x2000;
192 SysMin.bufSize = Program.global.sysMinBufSize;
194 /* Enable Memory Translation module that operates on the Resource Table */
195 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
196 Resource.loadSegment = Program.platform.dataMemory;
198 /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
199 /*
200 Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
201 Diags.ALWAYS_ON);
202 Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
203 Diags.INFO|Diags.USER1|Diags.STATUS,
204 Diags.ALWAYS_ON);
205 Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
206 Diags.ALWAYS_ON);
207 */
208 }
209 else if (Program.platformName.match(/^ti\.platforms\.cortexR:AM65X/) &&
210 Program.cpu.attrs.cpuCore.match(/^R5$/)) {
212 /* TODO: Need check on defaultHeapSize */
213 // Memory.defaultHeapSize = 0x20000;
214 var VirtQueue = xdc.useModule('ti.ipc.family.am65xx.VirtQueue');
216 /* Enable Memory Translation module that operates on the Resource Table */
217 var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
219 Resource.loadSymbol = "__RESOURCE_TABLE";
221 var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
222 MultiProc.setConfig("R5F-0", ["HOST", "R5F-0", "R5F-1"]);
224 xdc.loadCapsule("R5fmpu_am65xx.cfg");
226 var Hwi = xdc.useModule('ti.sysbios.family.arm.v7r.keystone3.Hwi');
227 /* TODO: Need to check on equivalent for K3 */
228 /* Hwi.enableException = true; */
230 SysMin.bufSize = 0x8000;
232 Program.sectMap[".tracebuf"] = "TRACE_BUF";
234 var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
235 /* Skip the Timer frequency verification check. Need to remove this later */
236 dmTimer.checkFrequency = false;
238 /* Match this to the SYS_CLK frequency sourcing the dmTimers.
239 * Not needed once the appropriate build target is used (Make sure
240 * SYS/BIOS family settings are updated */
241 dmTimer.intFreq.hi = 0;
242 dmTimer.intFreq.lo = 25000000;
244 /* Add idle function */
245 xdc.useModule('ti.sdo.ipc.family.am65xx.Power');
246 Idle.addFunc('&Power_Idle');
248 }else {
249 throw("ping_rpmsg_common.cfg: Did not match any platform!"
250 + " platform:" + Program.platformName + "cpuCore:"
251 + Program.cpu.attrs.cpuCore );
252 }
254 xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
255 BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup');
257 xdc.loadPackage('ti.ipc.rpmsg');
259 var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
260 var List = xdc.useModule('ti.sdo.utils.List');
262 xdc.useModule('ti.sysbios.xdcruntime.GateThreadSupport');
263 var GateSwi = xdc.useModule('ti.sysbios.gates.GateSwi');
265 var Assert = xdc.useModule('xdc.runtime.Assert');
266 var Defaults = xdc.useModule('xdc.runtime.Defaults');
267 var Diags = xdc.useModule('xdc.runtime.Diags');
268 var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
269 var LoggerSysParams = new LoggerSys.Params();
271 /* Enable Logger: */
272 Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
273 // FOR BENCHMARKING: Defaults.common$.logger = null;
275 /* Enable runtime Diags_setMask() for non-XDC spec'd modules: */
276 var Text = xdc.useModule('xdc.runtime.Text');
277 Text.isLoaded = true;
278 var Registry = xdc.useModule('xdc.runtime.Registry');
279 /*
280 Registry.common$.diags_INFO = Diags.ALWAYS_ON;
281 Registry.common$.diags_STATUS = Diags.ALWAYS_ON;
282 Registry.common$.diags_LIFECYCLE = Diags.ALWAYS_ON;
283 */
284 Diags.setMaskEnabled = true;
286 var Main = xdc.useModule('xdc.runtime.Main');
287 Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
288 Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;