collab/mm20
git clone https://git.julia.blue/collab/mm20
a795158
firmware
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 */ 32 33 34 35/*================ Clock configuration================ */ 36var 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 */ 42Clock.tickPeriod= 1000; 43 44 45 46/*================ Defaults (module) configuration================ */ 47var 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 */ 61Defaults.common$.namedModule= true; 62//Defaults.common$.namedModule= false; 63 64 65 66/*================ Error configuration================ */ 67var 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 */ 82Error.policyFxn= Error.policyDefault; 83//Error.policyFxn= Error.policySpin; 84 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 */ 99Error.raiseHook= Error.print; 100//Error.raiseHook= null; 101//Error.raiseHook= "&myErrorFxn"; 102 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 */ 110Error.maxDepth= 2; 111 112 113 114/*================ Hwi configuration================ */ 115var halHwi= xdc.useModule('ti.sysbios.hal.Hwi'); 116var 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 */ 128halHwi.checkStackFlag= true; 129//halHwi.checkStackFlag= false; 130 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 */ 152m3Hwi.enableException= true; 153//m3Hwi.enableException= false; 154//m3Hwi.excHandlerFunc= null; 155 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 */ 165m3Hwi.nvicCCR.DIV_0_TRP= 0; 166//m3Hwi.nvicCCR.DIV_0_TRP= 1; 167 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 */ 177m3Hwi.nvicCCR.UNALIGN_TRP= 0; 178//m3Hwi.nvicCCR.UNALIGN_TRP= 1; 179 180 181 182/*================ Idle configuration================ */ 183var 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"); 194 195 196 197/*================ Kernel (SYS/BIOS) configuration================ */ 198var 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; 209BIOS.assertsEnabled= false; 210 211/* 212 * Specify default heap size for BIOS. 213 */ 214BIOS.heapSize= 1024; 215 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 */ 229BIOS.includeXdcRuntime= false; 230//BIOS.includeXdcRuntime= true; 231 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 */ 246BIOS.libType= BIOS.LibType_Custom; 247//BIOS.libType= BIOS.LibType_Debug; 248 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 */ 261BIOS.runtimeCreatesEnabled= true; 262//BIOS.runtimeCreatesEnabled= false; 263 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; 275BIOS.logsEnabled= false; 276 277 278 279/*================ Memory configuration================ */ 280var 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 */ 286 287 288 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 */ 294if (!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} 301 302 303 304/* 305 * Enable Semihosting for GNU targets to print to CCS console 306 */ 307if (Program.build.target.$name.match(/gnu/)) { 308 var SemiHost= xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport'); 309} 310/*================ Semaphore configuration================ */ 311var Semaphore= xdc.useModule('ti.sysbios.knl.Semaphore'); 312/* 313 * Enables global support for Task priority pend queuing. 314 * 315 * Pick one: 316 * - true (default) 317 * This allows pending tasks to be serviced based on their task priority. 318 * - false 319 * Pending tasks are services based on first in, first out basis. 320 * 321 * When using BIOS in ROM: 322 * This option must be set to false. 323 */ 324//Semaphore.supportsPriority= true; 325Semaphore.supportsPriority= false; 326 327/* 328 * Allows for the implicit posting of events through the semaphore, 329 * disable for additional code saving. 330 * 331 * Pick one: 332 * - true 333 * This allows the Semaphore module to post semaphores and events 334 * simultaneously. 335 * - false (default) 336 * Events must be explicitly posted to unblock tasks. 337 * 338 */ 339//Semaphore.supportsEvents= true; 340Semaphore.supportsEvents= false; 341 342 343 344/*================ Swi configuration================ */ 345var Swi= xdc.useModule('ti.sysbios.knl.Swi'); 346/* 347 * A software interrupt is an object that encapsulates a function to be 348 * executed and a priority. Software interrupts are prioritized, preempt tasks 349 * and are preempted by hardware interrupt service routines. 350 * 351 * This module is included to allow Swi's in a users' application. 352 */ 353 354 355 356/*================ System configuration================ */ 357var System= xdc.useModule('xdc.runtime.System'); 358/* 359 * The Abort handler is called when the system exits abnormally. 360 * 361 * Pick one: 362 * - System.abortStd (default) 363 * Call the ANSI C Standard 'abort()' to terminate the application. 364 * - System.abortSpin 365 * A lightweight abort function that loops indefinitely in a while(1) trap 366 * function. 367 * - A custom abort handler 368 * A user-defined function. See the System module documentation for 369 * details. 370 */ 371System.abortFxn= System.abortStd; 372//System.abortFxn= System.abortSpin; 373//System.abortFxn= "&myAbortSystem"; 374 375/* 376 * The Exit handler is called when the system exits normally. 377 * 378 * Pick one: 379 * - System.exitStd (default) 380 * Call the ANSI C Standard 'exit()' to terminate the application. 381 * - System.exitSpin 382 * A lightweight exit function that loops indefinitely in a while(1) trap 383 * function. 384 * - A custom exit function 385 * A user-defined function. See the System module documentation for 386 * details. 387 */ 388System.exitFxn= System.exitStd; 389//System.exitFxn= System.exitSpin; 390//System.exitFxn= "&myExitSystem"; 391 392/* 393 * Minimize exit handler array in the System module. The System module includes 394 * an array of functions that are registered with System_atexit() which is 395 * called by System_exit(). The default value is 8. 396 */ 397System.maxAtexitHandlers= 2; 398 399/* 400 * The System.SupportProxy defines a low-level implementation of System 401 * functions such as System_printf(), System_flush(), etc. 402 * 403 * Pick one pair: 404 * - SysMin 405 * This module maintains an internal configurable circular buffer that 406 * stores the output until System_flush() is called. 407 * The size of the circular buffer is set via SysMin.bufSize. 408 * - SysCallback 409 * SysCallback allows for user-defined implementations for System APIs. 410 * The SysCallback support proxy has a smaller code footprint and can be 411 * used to supply custom System_printf services. 412 * The default SysCallback functions point to stub functions. See the 413 * SysCallback module's documentation. 414 */ 415var SysMin= xdc.useModule('xdc.runtime.SysMin'); 416SysMin.bufSize= 128; 417System.SupportProxy= SysMin; 418//var SysCallback= xdc.useModule('xdc.runtime.SysCallback'); 419//System.SupportProxy= SysCallback; 420//SysCallback.abortFxn= "&myUserAbort"; 421//SysCallback.exitFxn= "&myUserExit"; 422//SysCallback.flushFxn= "&myUserFlush"; 423//SysCallback.putchFxn= "&myUserPutch"; 424//SysCallback.readyFxn= "&myUserReady"; 425 426 427 428 429/*================ Task configuration================ */ 430var Task= xdc.useModule('ti.sysbios.knl.Task'); 431/* 432 * Check task stacks for overflow conditions. 433 * 434 * Pick one: 435 * - true (default) 436 * Enables runtime checks for task stack overflow conditions during 437 * context switching ("from" and "to") 438 * - false 439 * Disables runtime checks for task stack overflow conditions. 440 */ 441Task.checkStackFlag= true; 442//Task.checkStackFlag= false; 443 444/* 445 * Set the default task stack size when creating tasks. 446 * 447 * The default is dependent on the device being used. Reducing the default stack 448 * size yields greater memory savings. 449 */ 450Task.defaultStackSize= 512; 451 452/* 453 * Enables the idle task. 454 * 455 * Pick one: 456 * - true (default) 457 * Creates a task with priority of 0 which calls idle hook functions. This 458 * option must be set to true to gain power savings provided by the Power 459 * module. 460 * - false 461 * No idle task is created. This option consumes less memory as no 462 * additional default task stack is needed. 463 * To gain power savings by the Power module without having the idle task, 464 * add Idle.run as the Task.allBlockedFunc. 465 */ 466Task.enableIdleTask= true; 467//Task.enableIdleTask= false; 468//Task.allBlockedFunc= Idle.run; 469 470/* 471 * If Task.enableIdleTask is set to true, this option sets the idle task's 472 * stack size. 473 * 474 * Reducing the idle stack size yields greater memory savings. 475 */ 476Task.idleTaskStackSize= 512; 477 478/* 479 * Reduce the number of task priorities. 480 * The default is 16. 481 * Decreasing the number of task priorities yield memory savings. 482 */ 483Task.numPriorities= 16; 484 485 486 487/*================ Text configuration================ */ 488var Text= xdc.useModule('xdc.runtime.Text'); 489/* 490 * These strings are placed in the .const section. Setting this parameter to 491 * false will save space in the .const section. Error, Assert and Log messages 492 * will print raw ids and args instead of a formatted message. 493 * 494 * Pick one: 495 * - true (default) 496 * This option loads test string into the .const for easier debugging. 497 * - false 498 * This option reduces the .const footprint. 499 */ 500Text.isLoaded= true; 501//Text.isLoaded= false; 502 503 504 505/*================ Types configuration================ */ 506var Types= xdc.useModule('xdc.runtime.Types'); 507/* 508 * This module defines basic constants and types used throughout the 509 * xdc.runtime package. 510 */ 511 512 513 514/*================ TI-RTOS middleware configuration================ */ 515var mwConfig= xdc.useModule('ti.mw.Config'); 516/* 517 * Include TI-RTOS middleware libraries 518 */ 519 520 521 522/*================ TI-RTOS drivers' configuration================ */ 523var driversConfig= xdc.useModule('ti.drivers.Config'); 524/* 525 * Include TI-RTOS drivers 526 * 527 * Pick one: 528 * - driversConfig.LibType_NonInstrumented (default) 529 * Use TI-RTOS drivers library optimized for footprint and performance 530 * without asserts or logs. 531 * - driversConfig.LibType_Instrumented 532 * Use TI-RTOS drivers library for debugging with asserts and logs enabled. 533 */ 534driversConfig.libType= driversConfig.LibType_NonInstrumented; 535//driversConfig.libType= driversConfig.LibType_Instrumented; 536 537 538 539/*================ Application Specific Instances================ */ 540 541/* Use UARTMon with TI and GCC toolchains only */ 542if (!Program.build.target.$name.match(/iar/)) { 543 var UARTMon= xdc.useModule('ti.tirtos.utils.UARTMon'); 544 UARTMon.stackSize= 1024; 545}