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.

RTOS/F28M36P63C2: Runtime Determination of Task Blocked location

Part Number: F28M36P63C2
Other Parts Discussed in Thread: SYSBIOS,

Tool/software: TI-RTOS

Is there a way to determine on what object a task is blocked on at runtime in RTOS?

I use Task_stat() call to query the status of all my tasks and print the results out to my console.

void dumpTask(char* title, Task_Handle task)
{
    Task_Stat stat;
    Task_stat(task, &stat);

    uint32_t percent = (100UL * stat.used)/stat.stackSize;
#if defined(__TMS320C28XX__)
    DbgInfo("[%s %d] 0x%lx: 0x%4lx/0x%4lx (%3lu%%) %p-%p | [%s] %p | %s",
#else
    DbgInfo("[%s %d] 0x%x: 0x%4x/0x%4x (%3u%%) %p-%p | [%s] %p | %s",
#endif
                title,
                stat.priority,
                task,
                (uint32_t) stat.used,
                (uint32_t) stat.stackSize,
                percent,
                stat.stack,
                (uint32_t) stat.stack + (uint32_t) stat.stackSize,
                GetModeStr(stat.mode),
                (uint32_t)stat.sp,
                Task_Handle_name(task));
}

Which produces the following output when running normally:

12:48:10 PM 0099 FMS : [S TASK 0] 0xb540: 0x  6a/0x 100 ( 41%) @00008000-@00008100 | [READY] @00008056 | ti.sysbios.knl.Task.IdleTask
12:48:10 PM 0100 FMS : [D TASK 3] 0x83ac: 0x  ef/0x 200 ( 46%) @000083d0-@000085d0 | [BLOCKED] @0000842a | taskReadback
12:48:10 PM 0101 FMS : [D TASK 4] 0x85d4: 0x  d2/0x 200 ( 41%) @000085f8-@000087f8 | [BLOCKED] @00008654 | taskPID
12:48:10 PM 0102 FMS : [D TASK 3] 0x87fc: 0x  e6/0x 200 ( 44%) @00008820-@00008a20 | [BLOCKED] @000088a0 | taskRFProc
12:48:10 PM 0103 FMS : [D TASK 4] 0x8a24: 0x 281/0x 400 ( 62%) @00008a48-@00008e48 | [READY] @00008bbc | TFProtocol Loop
12:48:10 PM 0104 FMS : [D TASK 5] 0x8e4c: 0x 127/0x 200 ( 57%) @00008e70-@00009070 | [RUNNING] @00008ed6 | Smem Rx

I have discovered a bug in my application code where all my threads are blocked on something, and the application freezes:

2017-12-12 11:16:38.8178    Info        [S TASK 0] 0xb540: 0x  6a/0x 100 ( 41%) @00008000-@00008100 | [READY] @0000805e | ti.sysbios.knl.Task.IdleTask
2017-12-12 11:16:38.8178    Info        [D TASK 3] 0x83ac: 0x  d7/0x 200 ( 41%) @000083d0-@000085d0 | [BLOCKED] @00008474 | taskReadback
2017-12-12 11:16:38.8178    Info        [D TASK 4] 0x85d4: 0x  d2/0x 200 ( 41%) @000085f8-@000087f8 | [BLOCKED] @0000868c | taskPID
2017-12-12 11:16:38.8178    Info        [D TASK 3] 0x87fc: 0x  e6/0x 200 ( 44%) @00008820-@00008a20 | [BLOCKED] @000088a0 | taskRFProc
2017-12-12 11:16:38.8188    Info        [D TASK 4] 0x8a24: 0x 281/0x 400 ( 62%) @00008a48-@00008e48 | [BLOCKED] @00008be6 | TFProtocol Loop
2017-12-12 11:16:38.8188    Info        [D TASK 5] 0x8e4c: 0x 127/0x 200 ( 57%) @00008e70-@00009070 | [RUNNING] @00008ed6 | Smem Rx

I would like to know, from the above example, where the 'taskReadback', 'taskPID', 'taskRFProc', and 'TFProtocol Loop'  are blocking on.

Separately, I am only using Task_sleep() and GateMutex_enter/leave() in these threads, so I am curious why they all get blocked indefinitely. I have seen this post:  https://e2e.ti.com/support/embedded/tirtos/f/355/t/586830#pi317008=3 but it looks like my COMPARE_MARGIN is set to 12, so I would assume it is not the same issue.

Platform: ti.platforms.concertoC28:F28M36P63C2

RTOS: 2.16.1.14

Compiler: TI v16.9.3.LTS

XDCtools: 3.32.0.06_core

I am unable to use ROV at this point-in-time.

Derek

  • Hi Derek,

    We don't have a run-time method to get what is blocking the task. We currently have a pendElem field in the internal task object. ROV uses this along with the list of GateMutex, Semaphores, etc. to determine what the task is blocked on. We don't have an API that exposes this field (and we always reserve the right to change internal data structures).

    Todd