Reply by Randy Yates May 21, 20102010-05-21
PS: I checked the kernel/object window and the TSK object is only
showing one child - TSK_idle. That's after sleeping for 100 ticks too.

--Randy
Reply by Randy Yates May 21, 20102010-05-21
Spicerun <spicerun@gmail.com> writes:
> [...] > > A couple of suggestions I can think of: > > 1. Use the Kernel Object View under the DSP Bios Tools in Code Composer (I'm assuming you have Debug > enabled) and see what it shows for your task states.
What do you mean by having "Debug enabled"?
> 2. Are you really running your Tasks at Priority 1? Isn't Priority 1 also where the Idle Task resides as well? > You might want to run the tasks at Priority 3 or higher?
No, I'm running them at priority 8, as shown in the attrs.priority = 8.
> 3. I might consider putting a TSK_sleep of some number of ticks at the beginning of your task, so that the task > suspends immediately, and allows time for Bios to get the other tasks ready and running. Once the TSK_sleep > exits, then the other tasks should be running I would think. > 4. I do see that you are exiting main() after everything is setup -- which allows BIOS to start multitasking (as > you know, BIOS does not switch to any tasks until after main() has exited). > > That's all I can think of off the top of my head.
Thanks for those! I'll try when I get in today. -- Randy Yates % "Ticket to the moon, flight leaves here today Digital Signal Labs % from Satellite 2" mailto://yates@ieee.org % 'Ticket To The Moon' http://www.digitalsignallabs.com % *Time*, Electric Light Orchestra
Reply by Spicerun May 21, 20102010-05-21
On Thu, 20 May 2010 21:39:32 -0400, Randy Yates wrote:

> 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.
A couple of suggestions I can think of: 1. Use the Kernel Object View under the DSP Bios Tools in Code Composer (I'm assuming you have Debug enabled) and see what it shows for your task states. 2. Are you really running your Tasks at Priority 1? Isn't Priority 1 also where the Idle Task resides as well? You might want to run the tasks at Priority 3 or higher? 3. I might consider putting a TSK_sleep of some number of ticks at the beginning of your task, so that the task suspends immediately, and allows time for Bios to get the other tasks ready and running. Once the TSK_sleep exits, then the other tasks should be running I would think. 4. I do see that you are exiting main() after everything is setup -- which allows BIOS to start multitasking (as you know, BIOS does not switch to any tasks until after main() has exited). That's all I can think of off the top of my head.
Reply by Randy Yates May 20, 20102010-05-20
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://yates@ieee.org          %  
http://www.digitalsignallabs.com % 'Living' Thing', *A New World Record*, ELO