[processor-sdk/performance-audio-sr.git] / psdk_cust / libarch_k2g_1_0_1_0 / examples / dsponly / omp_config.cfg
1 /*
2 * Copyright (c) 2012-2015, Texas Instruments Incorporated
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 /* Import configuration for using FC EDMA */
34 var RMAN = xdc.useModule('ti.sdo.fc.rman.RMAN');
35 RMAN.useDSKT2 = false;
36 RMAN.persistentAllocFxn = "EdmaMgr_heap_alloc";
37 RMAN.persistentFreeFxn = "EdmaMgr_heap_free";
38 var EdmaMgr = xdc.useModule('ti.sdo.fc.edmamgr.EdmaMgr');
39 xdc.useModule('ti.sdo.fc.global.Settings').profile = "release";
41 /***************************/
42 /* SECTION MAPPING */
43 /***************************/
44 var program = xdc.useModule('xdc.cfg.Program');
46 program.sectMap[".args"] = new Program.SectionSpec();
47 program.sectMap[".bss"] = new Program.SectionSpec();
48 program.sectMap[".cinit"] = new Program.SectionSpec();
49 program.sectMap[".cio"] = new Program.SectionSpec();
50 program.sectMap[".const"] = new Program.SectionSpec();
51 program.sectMap[".data"] = new Program.SectionSpec();
52 program.sectMap[".far"] = new Program.SectionSpec();
53 program.sectMap[".fardata"] = new Program.SectionSpec();
54 program.sectMap[".neardata"] = new Program.SectionSpec();
55 program.sectMap[".rodata"] = new Program.SectionSpec();
56 program.sectMap[".stack"] = new Program.SectionSpec();
57 program.sectMap[".switch"] = new Program.SectionSpec();
58 program.sectMap[".sysmem"] = new Program.SectionSpec();
59 program.sectMap[".text"] = new Program.SectionSpec();
60 program.sectMap[".IRAM_DATA"] = new Program.SectionSpec();
61 program.sectMap[".DDR_DATA"] = new Program.SectionSpec();
62 program.sectMap[".MSMC_DATA"] = new Program.SectionSpec();
63 program.sectMap[".tdata"] = new Program.SectionSpec();
64 program.sectMap[".tbss"] = new Program.SectionSpec();
66 // Must place these sections in core local memory
67 program.sectMap[".args"].loadSegment = "L2SRAM";
68 program.sectMap[".cio"].loadSegment = "L2SRAM";
70 // Variables in the following data sections can potentially be 'shared' in
71 // OpenMP. These sections must be placed in shared memory.
72 program.sectMap[".bss"].loadSegment = "DDR3";
73 program.sectMap[".cinit"].loadSegment = "DDR3";
74 program.sectMap[".const"].loadSegment = "DDR3";
75 program.sectMap[".data"].loadSegment = "DDR3";
76 program.sectMap[".far"].loadSegment = "DDR3";
77 program.sectMap[".fardata"].loadSegment = "DDR3";
78 program.sectMap[".neardata"].loadSegment = "DDR3";
79 program.sectMap[".rodata"].loadSegment = "DDR3";
80 program.sectMap[".sysmem"].loadSegment = "DDR3";
81 program.sectMap[".IRAM_DATA"].loadSegment = "L2SRAM";
82 program.sectMap[".DDR_DATA"].loadSegment = "DDR3";
83 program.sectMap[".MSMC_DATA"].loadSegment = "MSMCSRAM";
84 program.sectMap[".tdata"].loadSegment = "DDR3";
85 program.sectMap[".tbss"].loadSegment = "DDR3";
87 // Code sections shared by cores - place in shared memory to avoid duplication
88 program.sectMap[".switch"].loadSegment = program.platform.codeMemory;
89 program.sectMap[".text"].loadSegment = program.platform.codeMemory;
91 // Size the default stack and place it in L2SRAM
92 var deviceName = String(Program.cpu.deviceName);
93 if (deviceName.search("DRA7XX") == -1) { program.stack = 0x20000; }
94 else { program.stack = 0x8000; }
96 program.sectMap[".stack"].loadSegment = "L2SRAM";
98 // Since there are no arguments passed to main, set .args size to 0
99 program.argSize = 0;
102 /********************************/
103 /* OPENMP RUNTIME CONFIGURATION */
104 /********************************/
106 // Include OMP runtime in the build
107 var ompSettings = xdc.useModule("ti.runtime.openmp.Settings");
109 // Set to true if the application uses or has dependencies on BIOS components
110 ompSettings.usingRtsc = true;
112 if (ompSettings.usingRtsc)
113 {
114 /* Configure OpenMP for BIOS
115 * - OpenMP.configureCores(masterCoreId, numberofCoresInRuntime)
116 * Configures the id of the master core and the number of cores
117 * available to the runtime.
118 */
120 var OpenMP = xdc.useModule('ti.runtime.ompbios.OpenMP');
122 // Configure the index of the master core and the number of cores available
123 // to the runtime. The cores are contiguous.
124 OpenMP.masterCoreIdx = 0;
126 // Setup number of cores based on the device
127 if (deviceName.search("DRA7XX") != -1) { OpenMP.numCores = 2; }
128 else if (deviceName.search("6670") != -1) { OpenMP.numCores = 4; }
129 else if (deviceName.search("6657") != -1) { OpenMP.numCores = 2; }
130 else { OpenMP.numCores = 8; }
132 // Pull in memory ranges described in Platform.xdc to configure the runtime
133 var ddr3 = Program.cpu.memoryMap["DDR3"];
134 var ddr3_nc = Program.cpu.memoryMap["DDR3_NC"];
135 var msmc = Program.cpu.memoryMap["MSMCSRAM"];
136 var msmcNcVirt = Program.cpu.memoryMap["OMP_MSMC_NC_VIRT"];
137 var msmcNcPhy = Program.cpu.memoryMap["OMP_MSMC_NC_PHY"];
139 // Initialize the runtime with memory range information
140 if (deviceName.search("DRA7XX") == -1) {
141 OpenMP.msmcBase = msmc.base
142 OpenMP.msmcSize = msmc.len;
144 OpenMP.msmcNoCacheVirtualBase = msmcNcVirt.base;
145 OpenMP.msmcNoCacheVirtualSize = msmcNcVirt.len;
147 OpenMP.msmcNoCachePhysicalBase = msmcNcPhy.base;
148 }
149 else
150 {
151 OpenMP.allocateStackFromHeap = true;
152 OpenMP.allocateStackFromHeapSize = 0x010000;
154 OpenMP.hasMsmc = false;
155 OpenMP.ddrNoCacheBase = ddr3_nc.base;
156 OpenMP.ddrNoCacheSize = ddr3_nc.len;
157 }
159 OpenMP.ddrBase = ddr3.base;
160 OpenMP.ddrSize = ddr3.len;
162 // Configure memory allocation using HeapOMP
163 // HeapOMP handles
164 // - Memory allocation requests from BIOS components (core local memory)
165 // - Shared memory allocation by utilizing the IPC module to enable
166 // multiple cores to allocate memory out of the same heap - used by malloc
167 if (deviceName.search("DRA7XX") == -1) {
168 var HeapOMP = xdc.useModule('ti.runtime.ompbios.HeapOMP');
170 // Shared Region 0 must be initialized for IPC
171 var sharedRegionId = 0;
173 // Size of the core local heap
174 var localHeapSize = 0x8000;
176 // Size of the heap shared by all the cores
177 var sharedHeapSize = 0x08000000;
179 // Initialize a Shared Region & create a heap in the DDR3 memory region
180 var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
181 SharedRegion.setEntryMeta( sharedRegionId,
182 { base: ddr3.base,
183 len: sharedHeapSize,
184 ownerProcId: OpenMP.masterCoreIdx,
185 cacheEnable: true,
186 createHeap: true,
187 isValid: true,
188 name: "DDR3_SR0",
189 });
191 // Configure and setup HeapOMP
192 HeapOMP.configure(sharedRegionId, localHeapSize);
193 }
194 else
195 {
196 OpenMP.useIpcSharedHeap = false;
197 OpenMP.allocateLocalHeapSize = 0x8000
198 OpenMP.allocateSharedHeapSize = 0x00800000
199 }
202 var Startup = xdc.useModule('xdc.runtime.Startup');
203 Startup.lastFxns.$add('&__TI_omp_initialize_rtsc_mode');
204 }
205 else
206 {
207 /* Size the heap. It must be placed in shared memory */
208 program.heap = sharedHeapSize;
209 }