1 /*
2 * Copyright (c) 2015-2016, 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 */
35 /* ================ Clock configuration ================ */
36 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
37 /*
38 * Default value is family dependent. For example, Linux systems often only
39 * support a minimum period of 10000 us and multiples of 10000 us.
40 * TI platforms have a default of 1000 us.
41 */
42 Clock.tickPeriod = 1000;
46 /* ================ Defaults (module) configuration ================ */
47 var Defaults = xdc.useModule('xdc.runtime.Defaults');
48 /*
49 * A flag to allow module names to be loaded on the target. Module name
50 * strings are placed in the .const section for debugging purposes.
51 *
52 * Pick one:
53 * - true (default)
54 * Setting this parameter to true will include name strings in the .const
55 * section so that Errors and Asserts are easier to debug.
56 * - false
57 * Setting this parameter to false will reduce footprint in the .const
58 * section. As a result, Error and Assert messages will contain an
59 * "unknown module" prefix instead of the actual module name.
60 */
61 Defaults.common$.namedModule = true;
62 //Defaults.common$.namedModule = false;
66 /* ================ Error configuration ================ */
67 var Error = xdc.useModule('xdc.runtime.Error');
68 /*
69 * This function is called to handle all raised errors, but unlike
70 * Error.raiseHook, this function is responsible for completely handling the
71 * error with an appropriately initialized Error_Block.
72 *
73 * Pick one:
74 * - Error.policyDefault (default)
75 * Calls Error.raiseHook with an initialized Error_Block structure and logs
76 * the error using the module's logger.
77 * - Error.policySpin
78 * Simple alternative that traps on a while(1) loop for minimized target
79 * footprint.
80 * Using Error.policySpin, the Error.raiseHook will NOT called.
81 */
82 Error.policyFxn = Error.policyDefault;
83 //Error.policyFxn = Error.policySpin;
85 /*
86 * If Error.policyFxn is set to Error.policyDefault, this function is called
87 * whenever an error is raised by the Error module.
88 *
89 * Pick one:
90 * - Error.print (default)
91 * Errors are formatted and output via System_printf() for easier
92 * debugging.
93 * - null
94 * Errors are not formatted or logged. This option reduces code footprint.
95 * - non-null function
96 * Errors invoke custom user function. See the Error module documentation
97 * for more details.
98 */
99 Error.raiseHook = Error.print;
100 //Error.raiseHook = null;
101 //Error.raiseHook = "&myErrorFxn";
103 /*
104 * If Error.policyFxn is set to Error.policyDefault, this option applies to the
105 * maximum number of times the Error.raiseHook function can be recursively
106 * invoked. This option limits the possibility of an infinite recursion that
107 * could lead to a stack overflow.
108 * The default value is 16.
109 */
110 Error.maxDepth = 2;
114 /* ================ Hwi configuration ================ */
115 var halHwi = xdc.useModule('ti.sysbios.hal.Hwi');
116 var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
117 /*
118 * Checks for Hwi (system) stack overruns while in the Idle loop.
119 *
120 * Pick one:
121 * - true (default)
122 * Checks the top word for system stack overflows during the idle loop and
123 * raises an Error if one is detected.
124 * - false
125 * Disabling the runtime check improves runtime performance and yields a
126 * reduced flash footprint.
127 */
128 halHwi.checkStackFlag = true;
129 //halHwi.checkStackFlag = false;
131 /*
132 * The following options alter the system's behavior when a hardware exception
133 * is detected.
134 *
135 * Pick one:
136 * - Hwi.enableException = true
137 * This option causes the default m3Hwi.excHandlerFunc function to fully
138 * decode an exception and dump the registers to the system console.
139 * This option raises errors in the Error module and displays the
140 * exception in ROV.
141 * - Hwi.enableException = false
142 * This option reduces code footprint by not decoding or printing the
143 * exception to the system console.
144 * It however still raises errors in the Error module and displays the
145 * exception in ROV.
146 * - Hwi.excHandlerFunc = null
147 * This is the most aggressive option for code footprint savings; but it
148 * can difficult to debug exceptions. It reduces flash footprint by
149 * plugging in a default while(1) trap when exception occur. This option
150 * does not raise an error with the Error module.
151 */
152 m3Hwi.enableException = true;
153 //m3Hwi.enableException = false;
154 //m3Hwi.excHandlerFunc = null;
156 /*
157 * Enable hardware exception generation when dividing by zero.
158 *
159 * Pick one:
160 * - 0 (default)
161 * Disables hardware exceptions when dividing by zero
162 * - 1
163 * Enables hardware exceptions when dividing by zero
164 */
165 m3Hwi.nvicCCR.DIV_0_TRP = 0;
166 //m3Hwi.nvicCCR.DIV_0_TRP = 1;
168 /*
169 * Enable hardware exception generation for invalid data alignment.
170 *
171 * Pick one:
172 * - 0 (default)
173 * Disables hardware exceptions for data alignment
174 * - 1
175 * Enables hardware exceptions for data alignment
176 */
177 m3Hwi.nvicCCR.UNALIGN_TRP = 0;
178 //m3Hwi.nvicCCR.UNALIGN_TRP = 1;
182 /* ================ Idle configuration ================ */
183 var Idle = xdc.useModule('ti.sysbios.knl.Idle');
184 /*
185 * The Idle module is used to specify a list of functions to be called when no
186 * other tasks are running in the system.
187 *
188 * Functions added here will be run continuously within the idle task.
189 *
190 * Function signature:
191 * Void func(Void);
192 */
193 //Idle.addFunc("&myIdleFunc");
197 /* ================ Kernel (SYS/BIOS) configuration ================ */
198 var BIOS = xdc.useModule('ti.sysbios.BIOS');
199 /*
200 * Enable asserts in the BIOS library.
201 *
202 * Pick one:
203 * - true (default)
204 * Enables asserts for debugging purposes.
205 * - false
206 * Disables asserts for a reduced code footprint and better performance.
207 */
208 BIOS.assertsEnabled = true;
209 //BIOS.assertsEnabled = false;
211 /*
212 * Specify default heap size for BIOS.
213 */
214 BIOS.heapSize = 1024;
216 /*
217 * A flag to determine if xdc.runtime sources are to be included in a custom
218 * built BIOS library.
219 *
220 * Pick one:
221 * - false (default)
222 * The pre-built xdc.runtime library is provided by the respective target
223 * used to build the application.
224 * - true
225 * xdc.runtime library sources are to be included in the custom BIOS
226 * library. This option yields the most efficient library in both code
227 * footprint and runtime performance.
228 */
229 BIOS.includeXdcRuntime = false;
230 //BIOS.includeXdcRuntime = true;
232 /*
233 * The SYS/BIOS runtime is provided in the form of a library that is linked
234 * with the application. Several forms of this library are provided with the
235 * SYS/BIOS product.
236 *
237 * Pick one:
238 * - BIOS.LibType_Custom
239 * Custom built library that is highly optimized for code footprint and
240 * runtime performance.
241 * - BIOS.LibType_Debug
242 * Custom built library that is non-optimized that can be used to
243 * single-step through APIs with a debugger.
244 *
245 */
246 BIOS.libType = BIOS.LibType_Custom;
247 //BIOS.libType = BIOS.LibType_Debug;
249 /*
250 * Runtime instance creation enable flag.
251 *
252 * Pick one:
253 * - true (default)
254 * Allows Mod_create() and Mod_delete() to be called at runtime which
255 * requires a default heap for dynamic memory allocation.
256 * - false
257 * Reduces code footprint by disallowing Mod_create() and Mod_delete() to
258 * be called at runtime. Object instances are constructed via
259 * Mod_construct() and destructed via Mod_destruct().
260 */
261 BIOS.runtimeCreatesEnabled = true;
262 //BIOS.runtimeCreatesEnabled = false;
264 /*
265 * Enable logs in the BIOS library.
266 *
267 * Pick one:
268 * - true (default)
269 * Enables logs for debugging purposes.
270 * - false
271 * Disables logging for reduced code footprint and improved runtime
272 * performance.
273 */
274 //BIOS.logsEnabled = true;
275 BIOS.logsEnabled = false;
279 /* ================ Memory configuration ================ */
280 var Memory = xdc.useModule('xdc.runtime.Memory');
281 /*
282 * The Memory module itself simply provides a common interface for any
283 * variety of system and application specific memory management policies
284 * implemented by the IHeap modules(Ex. HeapMem, HeapBuf).
285 */
289 /* ================ Program configuration ================ */
290 /*
291 * Program.stack is ignored with IAR. Use the project options in
292 * IAR Embedded Workbench to alter the system stack size.
293 */
294 if (!Program.build.target.$name.match(/iar/)) {
295 /*
296 * Reducing the system stack size (used by ISRs and Swis) to reduce
297 * RAM usage.
298 */
299 Program.stack = 768;
300 }
304 /*
305 * Uncomment to enable Semihosting for GNU targets to print to the CCS console.
306 * Please read the following TIRTOS Wiki page for more information on Semihosting:
307 * http://processors.wiki.ti.com/index.php/TI-RTOS_Examples_SemiHosting
308 */
310 if (Program.build.target.$name.match(/gnu/)) {
311 //var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
312 }
313 /* ================ Semaphore configuration ================ */
314 var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
315 /*
316 * Enables global support for Task priority pend queuing.
317 *
318 * Pick one:
319 * - true (default)
320 * This allows pending tasks to be serviced based on their task priority.
321 * - false
322 * Pending tasks are services based on first in, first out basis.
323 *
324 * When using BIOS in ROM:
325 * This option must be set to false.
326 */
327 //Semaphore.supportsPriority = true;
328 Semaphore.supportsPriority = false;
330 /*
331 * Allows for the implicit posting of events through the semaphore,
332 * disable for additional code saving.
333 *
334 * Pick one:
335 * - true
336 * This allows the Semaphore module to post semaphores and events
337 * simultaneously.
338 * - false (default)
339 * Events must be explicitly posted to unblock tasks.
340 *
341 */
342 //Semaphore.supportsEvents = true;
343 Semaphore.supportsEvents = false;
347 /* ================ Swi configuration ================ */
348 var Swi = xdc.useModule('ti.sysbios.knl.Swi');
349 /*
350 * A software interrupt is an object that encapsulates a function to be
351 * executed and a priority. Software interrupts are prioritized, preempt tasks
352 * and are preempted by hardware interrupt service routines.
353 *
354 * This module is included to allow Swi's in a users' application.
355 */
359 /* ================ System configuration ================ */
360 var System = xdc.useModule('xdc.runtime.System');
361 /*
362 * The Abort handler is called when the system exits abnormally.
363 *
364 * Pick one:
365 * - System.abortStd (default)
366 * Call the ANSI C Standard 'abort()' to terminate the application.
367 * - System.abortSpin
368 * A lightweight abort function that loops indefinitely in a while(1) trap
369 * function.
370 * - A custom abort handler
371 * A user-defined function. See the System module documentation for
372 * details.
373 */
374 System.abortFxn = System.abortStd;
375 //System.abortFxn = System.abortSpin;
376 //System.abortFxn = "&myAbortSystem";
378 /*
379 * The Exit handler is called when the system exits normally.
380 *
381 * Pick one:
382 * - System.exitStd (default)
383 * Call the ANSI C Standard 'exit()' to terminate the application.
384 * - System.exitSpin
385 * A lightweight exit function that loops indefinitely in a while(1) trap
386 * function.
387 * - A custom exit function
388 * A user-defined function. See the System module documentation for
389 * details.
390 */
391 System.exitFxn = System.exitStd;
392 //System.exitFxn = System.exitSpin;
393 //System.exitFxn = "&myExitSystem";
395 /*
396 * Minimize exit handler array in the System module. The System module includes
397 * an array of functions that are registered with System_atexit() which is
398 * called by System_exit(). The default value is 8.
399 */
400 System.maxAtexitHandlers = 2;
402 /*
403 * The System.SupportProxy defines a low-level implementation of System
404 * functions such as System_printf(), System_flush(), etc.
405 *
406 * Pick one pair:
407 * - SysMin
408 * This module maintains an internal configurable circular buffer that
409 * stores the output until System_flush() is called.
410 * The size of the circular buffer is set via SysMin.bufSize.
411 * - SysCallback
412 * SysCallback allows for user-defined implementations for System APIs.
413 * The SysCallback support proxy has a smaller code footprint and can be
414 * used to supply custom System_printf services.
415 * The default SysCallback functions point to stub functions. See the
416 * SysCallback module's documentation.
417 */
418 var SysMin = xdc.useModule('xdc.runtime.SysMin');
419 SysMin.bufSize = 128;
420 System.SupportProxy = SysMin;
421 //var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
422 //System.SupportProxy = SysCallback;
423 //SysCallback.abortFxn = "&myUserAbort";
424 //SysCallback.exitFxn = "&myUserExit";
425 //SysCallback.flushFxn = "&myUserFlush";
426 //SysCallback.putchFxn = "&myUserPutch";
427 //SysCallback.readyFxn = "&myUserReady";
432 /* ================ Task configuration ================ */
433 var Task = xdc.useModule('ti.sysbios.knl.Task');
434 /*
435 * Check task stacks for overflow conditions.
436 *
437 * Pick one:
438 * - true (default)
439 * Enables runtime checks for task stack overflow conditions during
440 * context switching ("from" and "to")
441 * - false
442 * Disables runtime checks for task stack overflow conditions.
443 */
444 Task.checkStackFlag = true;
445 //Task.checkStackFlag = false;
447 /*
448 * Set the default task stack size when creating tasks.
449 *
450 * The default is dependent on the device being used. Reducing the default stack
451 * size yields greater memory savings.
452 */
453 Task.defaultStackSize = 512;
455 /*
456 * Enables the idle task.
457 *
458 * Pick one:
459 * - true (default)
460 * Creates a task with priority of 0 which calls idle hook functions. This
461 * option must be set to true to gain power savings provided by the Power
462 * module.
463 * - false
464 * No idle task is created. This option consumes less memory as no
465 * additional default task stack is needed.
466 * To gain power savings by the Power module without having the idle task,
467 * add Idle.run as the Task.allBlockedFunc.
468 */
469 Task.enableIdleTask = true;
470 //Task.enableIdleTask = false;
471 //Task.allBlockedFunc = Idle.run;
473 /*
474 * If Task.enableIdleTask is set to true, this option sets the idle task's
475 * stack size.
476 *
477 * Reducing the idle stack size yields greater memory savings.
478 */
479 Task.idleTaskStackSize = 512;
481 /*
482 * Reduce the number of task priorities.
483 * The default is 16.
484 * Decreasing the number of task priorities yield memory savings.
485 */
486 Task.numPriorities = 16;
490 /* ================ Text configuration ================ */
491 var Text = xdc.useModule('xdc.runtime.Text');
492 /*
493 * These strings are placed in the .const section. Setting this parameter to
494 * false will save space in the .const section. Error, Assert and Log messages
495 * will print raw ids and args instead of a formatted message.
496 *
497 * Pick one:
498 * - true (default)
499 * This option loads test string into the .const for easier debugging.
500 * - false
501 * This option reduces the .const footprint.
502 */
503 Text.isLoaded = true;
504 //Text.isLoaded = false;
508 /* ================ Types configuration ================ */
509 var Types = xdc.useModule('xdc.runtime.Types');
510 /*
511 * This module defines basic constants and types used throughout the
512 * xdc.runtime package.
513 */
517 /* ================ TI-RTOS middleware configuration ================ */
518 var mwConfig = xdc.useModule('ti.mw.Config');
519 /*
520 * Include TI-RTOS middleware libraries
521 */
525 /* ================ TI-RTOS drivers' configuration ================ */
526 var driversConfig = xdc.useModule('ti.drivers.Config');
527 /*
528 * Include TI-RTOS drivers
529 *
530 * Pick one:
531 * - driversConfig.LibType_NonInstrumented (default)
532 * Use TI-RTOS drivers library optimized for footprint and performance
533 * without asserts or logs.
534 * - driversConfig.LibType_Instrumented
535 * Use TI-RTOS drivers library for debugging with asserts and logs enabled.
536 */
537 driversConfig.libType = driversConfig.LibType_NonInstrumented;
538 //driversConfig.libType = driversConfig.LibType_Instrumented;
542 /* ================ Application Specific Instances ================ */