This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DSP/BIOS Dynamic TSK_create()-ion under TMS320C6418



I'm trying to get three dynamically-created (versus creating statically
under the Tconf gui) tasks running but the tasks just won't run. They
are successfully created (TSK_create() returns non-null) but never run
according to the event log. This is taken from the tsk example under
the bios directory.

Any ideas/help would be appreciated.

--Randy

*************** .tcf file:

var mem_ext = [];
var device_regs = {
    /* The property l2Mode specifies the L2 cache setting. The valid values are:
     * "4-way cache (0k)", "4-way cache (32k)", "4-way cache (64k)",
     * "4-way cache (128k)", "4-way cache (256k)"
     */
    l2Mode: "4-way cache (0k)"

};

var params = {
    clockRate: 500,
    catalogName: "ti.catalog.c6000",
    deviceName: "6418",
    regs: device_regs,
    mem: mem_ext

};

utils.loadPlatform("ti.platforms.generic", params);
/**** End custom monitor platform definitions ****/

/* The following DSP/BIOS Features are enabled.  */
bios.enableRealTimeAnalysis(prog);
bios.enableRtdx(prog);
bios.enableTskManager(prog);

bios.GBL.SPECIFYRTSLIB = 0;
bios.MEM.NOMEMORYHEAPS = 0;
bios.MEM.instance("IRAM").createHeap = 1;
bios.MEM.instance("IRAM").heapSize = 0x8000;
//bios.MEM.instance("IRAM").enableHeapLabel = 1;
//bios.MEM.instance("IRAM").heapLabel = prog.extern("iram_heap", "asm");
bios.MEM.BIOSOBJSEG = prog.get("IRAM");
bios.MEM.MALLOCSEG = prog.get("IRAM");
//bios.TSK.STACKSEG = prog.get("IRAM");
// !GRAPHICAL_CONFIG_TOOL_SCRIPT_INSERT_POINT!

/**** example beg ****/
//bios.CLK.HIRESTIME = 1;
//bios.CLK.MICROSECONDS = 1000.0000;

/* Increase the buffer size of the LOG_system LOG object */

bios.LOG_system.bufLen = 256;

/* Create a trace LOG object for printing basic program output.  */

var trace = bios.LOG.create("trace");
trace.bufLen = 256;
trace.logType = "circular";

/* Create three TSKs of equal priority */

//var task0 = bios.TSK.create("task0");
//task0.priority = 1;
//task0["fxn"] = prog.extern("task");
//task0.arg0 = 0;
//
//var task1 = bios.TSK.create("task1");
//task1.priority = 1;
//task1["fxn"] = prog.extern("task");
//task1.arg0 = 1;
//
//var task2 = bios.TSK.create("task2");
//task2.priority = 1;
//task2["fxn"] = prog.extern("task");
//task2.arg0 = 2;

/**** example end ****/
prog.gen();

********** C file:

#include <stdint.h>
#include <std.h>
#include <log.h>
#include <tsk.h>
#include "monitorcfg.h"
#include "init.h"

Void MyTask(Arg id_arg);

Void main(void)
{
  TSK_Attrs  attrs = TSK_ATTRS;

  attrs.priority = 8;
  attrs.name = "thr1";
  if (TSK_create((Fxn)MyTask, &attrs, 1))
  {
    SYS_abort("Failed to open thr1 task");
  }
  attrs.name = "thr2";
  if (TSK_create((Fxn)MyTask, &attrs, 2))
  {
    SYS_abort("Failed to open thr2 task");
  }
  attrs.name = "thr3";
  if (TSK_create((Fxn)MyTask, &attrs, 3))
  {
    SYS_abort("Failed to open thr3 task");
  }

}

Void MyTask(Arg id_arg)
{
    Int     id = ArgToInt (id_arg);
    Int     i;

start:    
    LOG_printf(&trace, "Task %d begun", id);
    for (i = 0; i < 5 ; i++) {
        LOG_printf(&trace, "Loop %d: Task %d Working", i, id);
        TSK_yield();
//        TSK_sleep(10000);
    }
    LOG_printf(&trace, "Task %d DONE", id);
  goto start;

}

This is DSP/BIOS 5.33.06 under CCS 3.3 SR 11.
--
Randy Yates                      % "Rollin' and riding and slippin' and
Digital Signal Labs              %  sliding, it's magic."
mailto://ya...@ieee.org          %  
http://www.digitalsignallabs.com % 'Living' Thing', *A New World Record*, ELO

  • Hi Randy,

    Can you zip and attach your project so we can take a look?

  • Can you successfully run a BIOS tasking example (such as mutex)?

  • Randy,

    Looking at the code, you will never see LOG prints show up in CCS while the target is running. This is because your code never "blocks", since the TSK_sleep(10000) is commented out. All 3 tasks will just loop forever, yielding to each other. Since these tasks never block, the idle thread will never run, which is where the LOG buffers are transfered to the host CCS. What happens if you uncomment the TSK_sleep()? You should see the LOG prints show up when you stop the target, assuming stop-mode RTA is working.

    Mark

  • Hi Mark,

     

    I've always gotten the output after stopping - that wasn't the issue. The issue is that I wouldn't get "quasi-real-time" output as the system was running.

     

    --Randy

  • Mariana,

    Thanks for your reply and sorry I'm so late in responding. I've been working like mad on my actual application so this little side project has fallen by the wayside and I don't even have a good copy of it anymore. I could go back and look at the repository by date I suppose...

    Another couple of questions that may be related: what responsibility does the application have in dealing with interrupts associated with DSP/BIOS? For example, must the application enable the RTDXTX and RTDXRX interrupts? Must it globally enable interrupts? Must it enable timer interrupts? (I'm speaking of doing this, e.g., in main() before exiting to the dispatcher.)

    One problem I've found recently (this is a bit of a meander) is that the interrupt definitions in the CSL for CHIP_6418 do not match the interrupt locations specified in the 6418 datasheet. For example, IRQ_EVT_TIM1 is 2 while the datasheet states timer1 is interrupt 15. This is DSP/BIOS 5.33.06 and I'm now using cgtools 6.1.15 (under linux).

    --Randy

  • I should have told you how I'm really initializing things - it's not inside main().

    In order to use the TSK_sleep() function for timings, I moved all my initializations into a TSK_Init() task. I gave the task highest priority and order=1 of run so that it should run first before all other tasks. I also created a sem_InitDone semaphore and initialized it to one. The TSK_Init() pends on the semaphore initially and then posts to the semaphore when it's done. All other tasks in the system pend on the tsk_Init semaphore at their start, then post to the semaphore immediately after they unblock; in this manner several tasks can share the semaphore.

    So all initialization, including GPIO, interrupts, EDMA, etc., is done in this task which is after main() exits.

    My question then is pertaining to this context, namely, do I need to enable the RTDX RX/TX and timer interrupts, i.e., the interrupts used by DSP/BIOS, and do I need to globally enable interrupts?