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