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.

Getting the task instance name of the current running task from NMI function

MCU: TM4C1294NCPDT

TI-RTOS: v2.01.00.03

CCS: v6.0.1.0040

-

Hi,

    I have a TI-RTOS firmware running where I want to display the name of the running task when NMI is triggered. When, the NMI is triggered, the LCD should display the task name. For example, if there is a task defined in the .cfg file as follows

-

var taskParams = new Task.Params();
taskParams.instance.name = "DiTask";
taskParams.stackSize = 1000;
taskParams.priority = 6;
Program.global.task = Task.create("&dit", taskParams);

-


   lcd should display "DiTask". How to implement this? I am able to get the NMI triggered function run, but unable to figure out how to fetch the Task Instance Name from the RTOS kernel!! For the time being, the Task Instance Name printout on the console (instead of the hardware LCD) using System_printf() function will do.

    Will Task_self() help me in any way in this issue? Task_self() is supposed to be called from the Task domain & not NMI  function (as I understand, I may be wrong, correct me if I am), so can Task_self() be called in this case from the NMI triggered function?

    I have the same query for Task_Handle_name() too!! 

-

Thanks

-

Regards

Soumyajit

  • Hi Soumyajit,

    The name specified in taskParams.instance.name cannot be accessed by your application.  However, there is an "env" field in the Task params exclusively used for user customization.  Your config should change to something like the following:

    var taskParams = new Task.Params();
    taskParams.env = "DiTask";
    taskParams.stackSize = 1000;
    taskParams.priority = 6;
    Program.global.task = Task.create("&dit", taskParams);

    During runtime, you can call the following:

    Task_getEnv(Task_self())

    Which will return a pointer to the string assigned in the .cfg.

    Regards,

    -- Emmanuel

  • Thanks Emmanuel,
    That was exactly what I was looking for....
    Regards
    Soumyajit