/* * Copyright (c) 2018, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // @cliArgs --board /ti/boards/LP_CC1352P7_1 --rtos tirtos7 /* * border_router_nanostack_mesh_tirf.syscfg */ /* ======== RF ======== */ var RF = scripting.addModule("/ti/drivers/RF"); /* If an antenna component exists, assign it to the RF instance */ if (system.deviceData.board && system.deviceData.board.components.RF) { RF.$hardware = system.deviceData.board.components.RF; } /* ======== TRNG ======== */ var TRNG = scripting.addModule("/ti/drivers/TRNG", {}, false); var trng = TRNG.addInstance(); trng.$name = "NANOSTACK_TRNG"; /* ======== NVS ======== */ const deviceName = system.getScript("/ti/ti_wisunfan/ti_wisunfan_common.js").getLaunchPadFromDevice(); var NVS = scripting.addModule("/ti/drivers/NVS"); // Add a NVS module var NVS_INT = NVS.addInstance(); // Add an internal NVS module instance NVS_INT.$name = "CONFIG_NVSINTERNAL"; // Internal NVS if (deviceName.includes("R7") || deviceName.includes("P7")) { NVS_INT.internalFlash.regionBase = 0xAA000; } else { NVS_INT.internalFlash.regionBase = 0x52000; } NVS_INT.internalFlash.regionSize = 0x4000; // Sensor project has 2 NV pages default /* ======== Watchdog ======== */ var Watchdog = scripting.addModule("/ti/drivers/Watchdog", {}, false); var Watchdog1 = Watchdog.addInstance(); /* ======== UART ======== */ var UART = scripting.addModule("/ti/drivers/UART", {}, false); var UART1 = UART.addInstance(); UART1.$hardware = system.deviceData.board.components.XDS110UART; /* ======== TRNG ======== */ var TRNG = scripting.addModule("/ti/drivers/TRNG", {}, false); var TRNG1 = TRNG.addInstance(); /* ======== LED Red ======== */ var LED = scripting.addModule("/ti/drivers/apps/LED"); // Add a LED module var LED_R = LED.addInstance(); // Add a LED module instance for LED_R /* If a red LED component exists, assign it to the LED_R instance */ if (system.deviceData.board && system.deviceData.board.components.LED_RED) { LED_R.$hardware = system.deviceData.board.components.LED_RED; } else { LED_R.mode = "Output"; // Set the LED pin to output } LED_R.$name = "CONFIG_LED_RED"; LED_R.gpioPin.$name = "CONFIG_GPIO_RLED"; // Descriptive name for the LED_R GPIO LED_R.gpioPin.mode = "Output"; LED_R.gpioPin.callbackFunction = ""; /* ======== LED Green ======== */ var LED = scripting.addModule("/ti/drivers/apps/LED"); // Add a LED module var LED_G = LED.addInstance(); // Add a LED module instance for LED_G /* If a red LED component exists, assign it to the LED_G instance */ if (system.deviceData.board && system.deviceData.board.components.LED_GREEN) { LED_G.$hardware = system.deviceData.board.components.LED_GREEN; } else { LED_G.mode = "Output"; // Set the LED pin to output } LED_G.$name = "CONFIG_LED_GREEN"; LED_G.gpioPin.$name = "CONFIG_GPIO_GLED"; // Descriptive name for the LED_G GPIO LED_G.gpioPin.mode = "Output"; LED_G.gpioPin.callbackFunction = ""; /* ======== Left Button ======== */ var BUTTON = scripting.addModule("/ti/drivers/apps/Button"); // Add a BUTTON module var BUTTON_L = BUTTON.addInstance(); // Add a BUTTON module instance for BUTTON_L /* If a BUTTON0 component exists, assign it to the BUTTON_L instance */ if (system.deviceData.board && system.deviceData.board.components["BTN-1"]) { BUTTON_L.$hardware = system.deviceData.board.components["BTN-1"]; } BUTTON_L.$name = "CONFIG_BTN_LEFT"; BUTTON_L.gpioPin.$name = "CONFIG_GPIO_BTN1"; // Descriptive name for the BUTTON_L GPIO BUTTON_L.gpioPin.pull = "Pull Up"; // Use Pull up resistor /* ======== Right Button ======== */ var BUTTON = scripting.addModule("/ti/drivers/apps/Button"); // Add a BUTTON module var BUTTON_R = BUTTON.addInstance(); // Add a BUTTON module instance for BUTTON_R /* If a BUTTON0 component exists, assign it to the BUTTON_R instance */ if (system.deviceData.board && system.deviceData.board.components["BTN-2"]) { BUTTON_R.$hardware = system.deviceData.board.components["BTN-2"]; } BUTTON_R.$name = "CONFIG_BTN_RIGHT"; BUTTON_R.gpioPin.$name = "CONFIG_GPIO_BTN2"; // Descriptive name for the BUTTON_R GPIO BUTTON_R.gpioPin.pull = "Pull Up"; // Use Pull up resistor /* ======== RF Design ======== */ var rfDesign = scripting.addModule("ti/devices/radioconfig/rfdesign"); const rfDesignSettings = system.getScript("/ti/common/lprf_rf_design_settings.js").rfDesignSettings; for(var setting in rfDesignSettings) { rfDesign[setting] = rfDesignSettings[setting]; } /* ======== TI-15.4 Stack ======== */ var TI154Stack = scripting.addModule("/ti/ti_wisunfan/ti_wisunfan"); if(rfDesignSettings.rfDesign !== undefined) { TI154Stack.rfDesign = rfDesignSettings.rfDesign; } TI154Stack.project = "borderrouter"; TI154Stack.mode = "frequencyHopping"; TI154Stack.lockProject = true; TI154Stack.rxOnIdle = true; TI154Stack.panID = 0xABCD; TI154Stack.secureLevel = "macSecure"; /* ======== Device ======== */ var device = scripting.addModule("ti/devices/CCFG"); const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings; for(var setting in ccfgSettings) { device[setting] = ccfgSettings[setting]; } /* * Address to place reset vector on target device. * See the application's linker command file for further section * information. */ const Hwi = scripting.addModule("/ti/sysbios/family/arm/m3/Hwi"); Hwi.resetVectorAddress = system.utils.bigInt("0", 16); /* ================ Boot configuration ================ */ const Boot = scripting.addModule("/ti/sysbios/family/arm/cc26xx/Boot"); /* * This module contains family specific Boot APIs and configuration settings. * See the SYS/BIOS API guide for more information. */ /*! * Include a default customer configuration (CCFG) structure, default is * false. * Set to true to link in the default CCFG data structure in driverlib. */ Boot.customerConfig = false; /* ================ Clock configuration ================ */ const Clock = scripting.addModule("/ti/sysbios/knl/Clock"); /* * When using Power and calibrateRCOSC is set to true, this should be set to 10. * The timer used by the Clock module supports TickMode_DYNAMIC. This enables us * to set the tick period to 10 us without generating the overhead of additional * interrupts. * * Note: The calibrateRCOSC parameter is set within the Power configuration * structure in the "Board.c" file. */ Clock.tickPeriod = 10; /* ================ Error configuration ================ */ const Error = scripting.addModule("/ti/sysbios/runtime/Error"); /* * This function is called to handle all raised errors, but unlike * Error.raiseHook, this function is responsible for completely handling the * error with an appropriately initialized Error_Block. * * Pick one: * - Error_UNWIND * Returns back to the caller * - Error_SPIN * Simple alternative that traps on a while(1) loop for minimized target * footprint * Using Error_UNWIND, the Error.raiseHook will NOT called. * - Error_TERMINATE * Calls System_abort() */ Error.policy = "Error_UNWIND"; //Error.policy = "Error_TERMINATE"; //Error.policy = "Error_SPIN"; /* * If set to a non-null value, the referenced function is always called when * an error is raised, even if the Error policy is TERMINATE. * * Pick one: * - Error.print (default) * Errors are formatted and output via System_printf() for easier * debugging. * - Null * Errors are not formatted or logged. This option reduces code footprint. * - non-null function * Errors invoke custom user function. See the Error module documentation * for more details. */ //Error.raiseHook = Error.print; Error.raiseHook = "NULL"; //Error.raiseHook = "myErrorFxn"; /* ================ Hwi configuration ================ */ /* * Checks for Hwi (system) stack overruns while in the Idle loop. * * Pick one: * - true (default) * Checks the top word for system stack overflows during the idle loop and * raises an Error if one is detected. * - false * Disabling the runtime check improves runtime performance and yields a * reduced flash footprint. */ //Hwi.checkStackFlag = true; Hwi.checkStackFlag = false; /* * The following options alter the system's behavior when a hardware exception * is detected. * * Pick one: * - Hwi.enableException = true * This option causes the default Hwi.excHandlerFunc function to fully * decode an exception and dump the registers to the system console. * This option raises errors in the Error module and displays the * exception in ROV. * - Hwi.enableException = false * This option reduces code footprint by not decoding or printing the * exception to the system console. * It however still raises errors in the Error module and displays the * exception in ROV. * - Hwi.excHandlerFunc = null * This is the most aggressive option for code footprint savings; but it * can difficult to debug exceptions. It reduces flash footprint by * plugging in a default while(1) trap when exception occur. This option * does not raise an error with the Error module. */ //Hwi.enableException = true; Hwi.enableException = false; //Hwi.excHandlerFunc = null; /* * Append any of the following settings to the nvicCCR array to enable the * corresponding hardware exception: * - DIV_0_TRP: Enables hardware exception when dividing by zero * - UNALIGN_TRP: Enables hardware exceptions when accessing unaligned memory * */ Hwi.nvicCCR = []; //Hwi.nvicCCR = ["DIV_0_TRP"]; //Hwi.nvicCCR = [UNALIGN_TRP"]; //Hwi.nvicCCR = ["DIV_0_TRP","UNALIGN_TRP"]; /* ================ Idle configuration ================ */ const Idle = scripting.addModule("/ti/sysbios/knl/Idle"); const powerIdle = Idle.addInstance(); /* * The Idle module is used to specify a list of functions to be called when no * other tasks are running in the system. * * Functions added here will be run continuously within the idle task. * * Function signature: * Void func(Void); */ powerIdle.$name = "powerIdle"; powerIdle.idleFxn = "Power_idleFunc"; /* Add the Power module's idle function */ /* ================ Kernel (SYS/BIOS) configuration ================ */ const BIOS = scripting.addModule("/ti/sysbios/BIOS"); /* * Enable asserts in the BIOS library. * * Pick one: * - true (default) * Enables asserts for debugging purposes. * - false * Disables asserts for a reduced code footprint and better performance. * * When using BIOS in ROM: * This option must be set to false. */ //BIOS.assertsEnabled = true; BIOS.assertsEnabled = false; /* * Runtime instance creation enable flag. * * Pick one: * - true (default) * Allows Mod_create() and Mod_delete() to be called at runtime which * requires a default heap for dynamic memory allocation. * - false * Reduces code footprint by disallowing Mod_create() and Mod_delete() to * be called at runtime. Object instances are constructed via * Mod_construct() and destructed via Mod_destruct(). * * When using BIOS in ROM: * This option must be set to true. */ BIOS.runtimeCreatesEnabled = true; //BIOS.runtimeCreatesEnabled = false; /* * Enable logs in the BIOS library. * * Pick one: * - true (default) * Enables logs for debugging purposes. * - false * Disables logging for reduced code footprint and improved runtime * performance. * * When using BIOS in ROM: * This option must be set to false. */ //BIOS.logsEnabled = true; BIOS.logsEnabled = false; BIOS.rtsGateType = "BIOS_GateMutexPri"; BIOS.heapSize = 0x00000000; BIOS.heapType = "HeapCallback"; /* ================ Semaphore configuration ================ */ const Semaphore = scripting.addModule("/ti/sysbios/knl/Semaphore"); /* * Enables global support for Task priority pend queuing. * * Pick one: * - true (default) * This allows pending tasks to be serviced based on their task priority. * - false * Pending tasks are services based on first in, first out basis. * * When using BIOS in ROM: * This option must be set to false. */ //Semaphore.supportsPriority = true; Semaphore.supportsPriority = false; /* * Allows for the implicit posting of events through the semaphore, * disable for additional code saving. * * Pick one: * - true * This allows the Semaphore module to post semaphores and events * simultaneously. * - false (default) * Events must be explicitly posted to unblock tasks. * * When using BIOS in ROM: * This option must be set to false. */ //Semaphore.supportsEvents = true; Semaphore.supportsEvents = false; /* ================ Swi configuration ================ */ const Swi = scripting.addModule("/ti/sysbios/knl/Swi"); /* * A software interrupt is an object that encapsulates a function to be * executed and a priority. Software interrupts are prioritized, preempt tasks * and are preempted by hardware interrupt service routines. * * This module is included to allow Swi's in a users' application. */ /* * Reduce the number of swi priorities from the default of 16. * Decreasing the number of swi priorities yields memory savings. */ Swi.numPriorities = 6; /* ================ System configuration ================ */ const System = scripting.addModule("/ti/sysbios/runtime/System"); /* * The Abort handler is called when the system exits abnormally. * * Pick one: * - System_abortStd (default) * Call the ANSI C Standard 'abort()' to terminate the application. * - System_abortSpin * A lightweight abort function that loops indefinitely in a while(1) trap * function. * - A custom abort handler * A user-defined function. See the System module documentation for * details. */ //System.abortFxn = "System_abortStd"; System.abortFxn = "System_abortSpin"; //System.abortFxn = "myAbortSystem"; /* * The Exit handler is called when the system exits normally. * * Pick one: * - System_exitStd (default) * Call the ANSI C Standard 'exit()' to terminate the application. * - System_exitSpin * A lightweight exit function that loops indefinitely in a while(1) trap * function. * - A custom exit function * A user-defined function. See the System module documentation for * details. */ //System.exitFxn = "System_exitStd"; System.exitFxn = "System_exitSpin"; //System.exitFxn = "myExitSystem"; /* * Minimize exit handler array in the System module. The System module includes * an array of functions that are registered with System_atexit() which is * called by System_exit(). */ System.maxAtexitHandlers = 2; /* * Enable System_printf() to display floats. Use the longer '%f%$L%$S%$F' * if your code has SYS/BIOS instrumentation enabled (Asserts/Error/Log), * as is typical with the 'debug' profile. */ //System.extendedFormats = '%f%$L%$S%$F'; System.extendedFormats = '%f%$S'; /* * The System.supportModule defines a low-level implementation of System * functions such as System_printf(), System_flush(), etc. * * Pick one pair: * - SysMin * This module maintains an internal configurable circular buffer that * stores the output until System_flush() is called. * The size of the circular buffer is set via SysMin.bufSize. * - SysCallback * SysCallback allows for user-defined implementations for System APIs. * The SysCallback support module has a smaller code footprint and can be * used to supply custom System_printf services. * The default SysCallback functions point to stub functions. See the * SysCallback module's documentation. */ //const SysMin = scripting.addModule("/ti/sysbios/runtime/SysMin"); //System.supportModule = "SysMin"; //SysMin.bufSize = 1024; System.supportModule = "SysCallback"; const SysCallback = scripting.addModule("/ti/sysbios/runtime/SysCallback"); //SysCallback.abortFxn = "myUserAbort"; //SysCallback.exitFxn = "myUserExit"; //SysCallback.flushFxn = "myUserFlush"; SysCallback.putchFxn = "ns_put_char_blocking"; //SysCallback.readyFxn = "myUserReady"; /* ================ Task configuration ================ */ const Task = scripting.addModule("/ti/sysbios/knl/Task"); /* * Check task stacks for overflow conditions. * * Pick one: * - true (default) * Enables runtime checks for task stack overflow conditions during * context switching ("from" and "to") * - false * Disables runtime checks for task stack overflow conditions. * * When using BIOS in ROM: * This option must be set to false. */ //Task.checkStackFlag = true; Task.checkStackFlag = false; /* * Set the default task stack size when creating tasks. * * The default is dependent on the device being used. Reducing the default stack * size yields greater memory savings. */ Task.defaultStackSize = 512; /* * Enables the idle task. * * Pick one: * - true (default) * Creates a task with priority of 0 which calls idle hook functions. This * option must be set to true to gain power savings provided by the Power * module. * - false * No idle task is created. This option consumes less memory as no * additional default task stack is needed. * To gain power savings by the Power module without having the idle task, * add Idle.run as the Task.allBlockedFunc. */ Task.enableIdleTask = true; //Task.enableIdleTask = false; //Task.allBlockedFunc = Idle.run; /* * If Task.enableIdleTask is set to true, this option sets the idle task's * stack size. * * Reducing the idle stack size yields greater memory savings. */ Task.idleTaskStackSize = 512; /* * Reduce the number of task priorities. * Decreasing the number of task priorities yield memory savings. */ Task.numPriorities = 6; /* ================ GateMutexPri configuration ================ */ const GateMutexPri = scripting.addModule("/ti/sysbios/gates/GateMutexPri"); /* ================ Memory configuration ================ */ const HeapCallback = scripting.addModule("/ti/sysbios/heaps/HeapCallback"); HeapCallback.initFxn = 'osalHeapInitFxn'; // Call First When BIOS boot. Initialize the Heap Manager. HeapCallback.allocInstFxn = 'osalHeapAllocFxn'; // Call for allocating a buffer HeapCallback.freeInstFxn = 'osalHeapFreeFxn'; // Call for Freeing a buffer HeapCallback.getStatsInstFxn = 'osalHeapGetStatsFxn'; // Return Statistic on the Heap. HeapCallback.isBlockingInstFxn = 'osalHeapIsBlockingFxn'; // Return TRUE: This heap is always blocking ('Hwi Gate' like ) const Memory = scripting.addModule("/ti/sysbios/runtime/Memory"); const Settings = scripting.addModule("/ti/posix/tirtos/Settings"); /* ================ Event configuration ================ */ const Event = scripting.addModule("/ti/sysbios/knl/Event"); /* ================ Mailbox configuration ================ */ const Mailbox = scripting.addModule("ti/sysbios/knl/Mailbox");