• dsp6657的helloworld例程测试-第二篇-CFG文件


    1. 上一篇疑问,int StackTest()这个函数是怎么运行的,后来在.cfg文件找到了答案,.cfg包含丰富的信息,对于用惯C语言的,确实不太习惯

      1 var Memory  =   xdc.useModule('xdc.runtime.Memory');
      2 //使用的模块,XDCTools配置工具,
      3 var BIOS    =   xdc.useModule('ti.sysbios.BIOS');
      4 
      5 var Task    =   xdc.useModule('ti.sysbios.knl.Task');
      6 
      7 var HeapBuf =   xdc.useModule('ti.sysbios.heaps.HeapBuf');
      8 
      9 var Log     =   xdc.useModule('xdc.runtime.Log');
     10 
     11 /*
     12 ** Allow storing of task names. By default if you name a task with a friendly display name it will not be saved
     13 ** to conserve RAM. This must be set to true to allow it. We use friendly names on the Task List display.
     14 */
     15 //Defaults.common$.namedInstance = true; 
     16 Task.common$.namedInstance = true;
     17 
     18 var Clock   =   xdc.useModule ('ti.sysbios.knl.Clock');
     19 
     20 /* 
     21 ** Interface with IPC. Depending on the version of BIOS you are using the 
     22 ** module name may have changed.
     23 */
     24 /* Use this for pre BIOS 6.30 */
     25 /* var Sem        =      xdc.useModule ('ti.sysbios.ipc.Semaphore'); */
     26 
     27 /* Use this for BIOS 6.30 plus to get the IPC module */
     28 var Sem    = xdc.useModule ('ti.sysbios.knl.Semaphore');
     29 
     30 var Hwi    = xdc.useModule ('ti.sysbios.hal.Hwi');
     31 
     32 var Ecm = xdc.useModule ('ti.sysbios.family.c64p.EventCombiner');
     33 
     34 /*
     35 ** Configure this to turn on the CPU Load Module for BIOS.
     36 **
     37 */
     38 /*
     39 var Load       =   xdc.useModule('ti.sysbios.utils.Load');
     40 Load.common$.diags_USER4 = Diags.ALWAYS_ON;
     41 */
     42 
     43 var Diags       = xdc.useModule('xdc.runtime.Diags');
     44 
     45 /* 
     46 ** Sets up the exception log so you can read it with ROV in CCS 
     47 */
     48 //var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
     49 //var Exc = xdc.useModule('ti.sysbios.family.c66x.Exception');
     50 //Exc.common$.logger = LoggerBuf.create();
     51 //Exc.enablePrint = true; /* prints exception details to the CCS console */
     52 
     53 /*
     54 **  Give the Load module it's own LoggerBuf to make sure the
     55 **  events are not overwritten.
     56 */
     57 /* var loggerBufParams = new LoggerBuf.Params();
     58 loggerBufParams.exitFlush = true;
     59 loggerBufParams.numEntries = 64;
     60 Load.common$.logger = LoggerBuf.create(loggerBufParams); 
     61 */
     62 
     63 /* Load the CSL package */
     64 var Csl                         =     xdc.useModule('ti.csl.Settings');
     65 
     66 /* Load the CPPI package */
     67 var Cppi                        =   xdc.loadPackage('ti.drv.cppi');     
     68 
     69 /* Load the QMSS package */
     70 var Qmss                        =   xdc.loadPackage('ti.drv.qmss');
     71 
     72 /* Load the Platform/NDK Transport/EMAC packages */
     73 var PlatformLib  = xdc.loadPackage('ti.platform.evmc6657l');
     74 var NdkTransport = xdc.loadPackage('ti.transport.ndk');
     75 var EmacLLD = xdc.loadPackage('ti.drv.emac');
     76 
     77 /*
     78 ** Use this load to configure NDK 2.2 and above using RTSC. In previous versions of
     79 ** the NDK RTSC configuration was not supported and you should comment this out.
     80 */
     81 var Global       = xdc.useModule('ti.ndk.config.Global');
     82 
     83 /* 
     84 ** This allows the heart beat (poll function) to be created but does not generate the stack threads 
     85 **
     86 ** Look in the cdoc (help files) to see what CfgAddEntry items can be configured. We tell it NOT
     87 ** to create any stack threads (services) as we configure those ourselves in our Main Task
     88 ** thread hpdspuaStart.
     89 */  
     90 Global.enableCodeGeneration = false;
     91 
     92 
     93 var Startup     =   xdc.useModule('xdc.runtime.Startup');
     94 
     95 var System      =   xdc.useModule('xdc.runtime.System');
     96 
     97 
     98 
     99 /*
    100 ** Create a Heap. 
    101 */
    102 var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    103 var heapMemParams = new HeapMem.Params();
    104 heapMemParams.size = 0x30000;
    105 heapMemParams.sectionName = "systemHeap";
    106 Program.global.heap0 = HeapMem.create(heapMemParams);
    107 
    108 /* This is the default memory heap. */
    109 Memory.defaultHeapInstance  =   Program.global.heap0;
    110 Program.sectMap["emacComm"] = "DDR3";
    111 Program.sectMap["systemHeap"] = "DDR3";
    112 Program.sectMap[".switch"]  = "DDR3";
    113 Program.sectMap[".sysmem"]  = "DDR3";
    114 Program.sectMap[".args"]    = "DDR3";
    115 Program.sectMap[".cio"]     = "DDR3";
    116 Program.sectMap[".far"]     =     "DDR3";
    117 Program.sectMap[".cinit"]     =     "DDR3";
    118 Program.sectMap[".bss"]        =    "DDR3";
    119 Program.sectMap[".rodata"]        =    "DDR3";
    120 Program.sectMap[".neardata"]        =    "DDR3";
    121 Program.sectMap[".const"]    =    "DDR3";
    122 Program.sectMap[".text"]    =    "DDR3";
    123 Program.sectMap[".code"]    =    "DDR3";
    124 Program.sectMap[".data"]    =    "DDR3";
    125 Program.sectMap["platform_lib"]     =     "DDR3";
    126 Program.sectMap[".far:taskStackSection"] = "L2SRAM";
    127 Program.sectMap[".stack"]    =    "L2SRAM";
    128 Program.sectMap[".far:IMAGEDATA"] = {loadSegment: "L2SRAM", loadAlign: 8};
    129 Program.sectMap[".far:NDK_OBJMEM"] = {loadSegment: "L2SRAM", loadAlign: 8};
    130 Program.sectMap[".far:NDK_PACKETMEM"] = {loadSegment: "L2SRAM", loadAlign: 128};
    131 
    132 /* Required if using System_printf to output on the console */
    133 SysStd                  =   xdc.useModule('xdc.runtime.SysStd');
    134 System.SupportProxy     =   SysStd;
    135 
    136 /********************************************************************************************************************
    137 * Define hooks and static tasks  that will always be running.                                                       *
    138  ********************************************************************************************************************/
    139 
    140 /* 
    141 ** Register an EVM Init handler with BIOS. This will initialize the hardware. BIOS calls before it starts. 
    142 **
    143 ** If yuo are debugging with CCS, then this function will execute as CCS loads it if the option in your 
    144 ** Target Configuraiton file (.ccxml) has the option set to execute all code before Main. That is the 
    145 ** default.
    146 */
    147 Startup.firstFxns.$add('&EVM_init');
    148 
    149 /* 
    150 ** Create the stack Thread Task for our application.
    151 */
    152 var tskNdkStackTest          =   Task.create("&StackTest");
    153 tskNdkStackTest.stackSize      =     0x1000;
    154 tskNdkStackTest.priority    =     0x5;
    155 
    156 
    157 /* 
    158 ** Create a Periodic task to handle all NDK polling functions. 
    159 ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default and 
    160 ** you do not need to do this.
    161 */
    162 /*var prdNdkClkParams         =   new Clock.Params ();
    163 prdNdkClkParams.period      =   0x64;   
    164 prdNdkClkParams.startFlag   =   true;
    165 Program.global.clockInst1   =   Clock.create("&llTimerTick", 5, prdNdkClkParams);
    166 */
    167 
    168 /* 
    169 ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default, else
    170 ** register hooks so that the stack can track all Task creation 
    171 Task.common$.namedInstance  =   true;
    172 Task.addHookSet ({ registerFxn: '&NDK_hookInit', createFxn: '&NDK_hookCreate', });
    173 
    174 /* Enable BIOS Task Scheduler */
    175 BIOS.taskEnabled            =   true;

    2. RTSC里面有包的概念,类似于java语言的包格式,如下,其实也就是函数库,也可以说是,这个工程使用这个模块,不用再C语言添加代码了。

    1 ti.sysbios.knl.Semaphore

    3. 真正的任务创建函数,终于找到你

    1 var tskNdkStackTest          =   Task.create("&StackTest");
    2 tskNdkStackTest.stackSize      =     0x1000;
    3 tskNdkStackTest.priority    =     0x5;

    4. 这个是启动函数

    1 Startup.firstFxns.$add('&EVM_init');

    5. 钩子函数,和启动任务调度,每一个任务都可以有一个钩子函数,用途暂时不明白。

    1 Task.common$.namedInstance  =   true;
    2 Task.addHookSet ({ registerFxn: '&NDK_hookInit', createFxn: '&NDK_hookCreate', });
    3 
    4 /* Enable BIOS Task Scheduler */
    5 BIOS.taskEnabled            =   true;

    6. 不是很习惯,非C语言的配置方式。

  • 相关阅读:
    Educational Codeforces Round 58
    Educational Codeforces Round 59
    Codeforces Round #534 (Div. 2)
    Codeforces Round #531 (Div. 3)
    Codeforces Round #536 (Div. 2)
    Codeforces Round #530 (Div. 2)
    Codeforces Round #533 (Div. 2)
    Codeforces Round #535 (Div. 3)
    Codeforces Round #532 (Div. 2)
    Codeforces Round #538 (Div. 2)
  • 原文地址:https://www.cnblogs.com/429512065qhq/p/8082787.html
Copyright © 2020-2023  润新知