Thanks for the response, @aggarg :
Are you posting something to the queue so that this task unblocks?
Yes I am; I’ve even confirmed in gdb
:
Thread 2 hit Breakpoint 1, working_02_task (pvParameters=<optimized out>) at C:/path/to/MY_TEST_PROGRAM/working_02.c:370
370 if (xQueueSend(my_printer_task_queue, (void *)&my_var, (TickType_t) 0 ) != pdTRUE) {
(gdb) n
380 my_var = 0; // data sent to queue, proceed
… that xQueueSend
to this queue does indeed return pdTRUE
?!
However, that seems to me is not really the problem, because as I’ve mentioned in OP: when I set breakpoints on the working tasks (by function name), these breakpoints do fire at function entry - before any while(1)
in them starts running, and before any signals (via queue etc) are sent to the tasks, so they do actual work.
In my problem case, though, setting a breakpoint on the non-running my_printer_task
does not ever fire.
What are the priorities of all the tasks?
- 1 (that is, tskIDLE_PRIORITY+1)
- configMAX_PRIORITIES-1
- configMAX_PRIORITIES-2
- configMAX_PRIORITIES-3
- configMAX_PRIORITIES-4 (this is the problematic
my_printer_task
)
Also, printf
may not be thread safe - can you try removing printf
and check by just putting a break point?
As I mentioned earlier, I already tried a breakpoint on the my_printer_task
(so on function entry), and it never fires.
But, I did also remove the printf
, and I placed a breakpoint on the queue waiting line (which in my case is something like while (xQueueReceive(my_printer_queue, (void *)&queuedataitem, 0) == pdTRUE) {
, and the printf
was inside) - that one never fires either.
Here it is - FreeRTOS-Kernel/tasks.c at main · FreeRTOS/FreeRTOS-Kernel · GitHub
Thanks for that - just tried inspecting it, and boy - it will be hard to find what goes on here:
(gdb) p pxReadyTasksLists
$1 = {{uxNumberOfItems = 2, pxIndex = 0x20001760 <pxReadyTasksLists+8>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20004fb0 <ucHeap+11604>, pxPrevious = 0x20005438 <ucHeap+12764>}}, {uxNumberOfItems = 0,
pxIndex = 0x20001774 <pxReadyTasksLists+28>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001774 <pxReadyTasksLists+28>, pxPrevious = 0x20001774 <pxReadyTasksLists+28>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001788 <pxReadyTasksLists+48>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001788 <pxReadyTasksLists+48>, pxPrevious = 0x20001788 <pxReadyTasksLists+48>}}, {
uxNumberOfItems = 0, pxIndex = 0x2000179c <pxReadyTasksLists+68>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x2000179c <pxReadyTasksLists+68>, pxPrevious = 0x2000179c <pxReadyTasksLists+68>}}, {
uxNumberOfItems = 0, pxIndex = 0x200017b0 <pxReadyTasksLists+88>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200017b0 <pxReadyTasksLists+88>, pxPrevious = 0x200017b0 <pxReadyTasksLists+88>}}, {
uxNumberOfItems = 0, pxIndex = 0x200017c4 <pxReadyTasksLists+108>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200017c4 <pxReadyTasksLists+108>, pxPrevious = 0x200017c4 <pxReadyTasksLists+108>}}, {
uxNumberOfItems = 0, pxIndex = 0x200017d8 <pxReadyTasksLists+128>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200017d8 <pxReadyTasksLists+128>, pxPrevious = 0x200017d8 <pxReadyTasksLists+128>}}, {
uxNumberOfItems = 0, pxIndex = 0x200017ec <pxReadyTasksLists+148>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200017ec <pxReadyTasksLists+148>, pxPrevious = 0x200017ec <pxReadyTasksLists+148>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001800 <pxReadyTasksLists+168>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001800 <pxReadyTasksLists+168>, pxPrevious = 0x20001800 <pxReadyTasksLists+168>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001814 <pxReadyTasksLists+188>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001814 <pxReadyTasksLists+188>, pxPrevious = 0x20001814 <pxReadyTasksLists+188>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001828 <pxReadyTasksLists+208>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001828 <pxReadyTasksLists+208>, pxPrevious = 0x20001828 <pxReadyTasksLists+208>}}, {
uxNumberOfItems = 0, pxIndex = 0x2000183c <pxReadyTasksLists+228>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x2000183c <pxReadyTasksLists+228>, pxPrevious = 0x2000183c <pxReadyTasksLists+228>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001850 <pxReadyTasksLists+248>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001850 <pxReadyTasksLists+248>, pxPrevious = 0x20001850 <pxReadyTasksLists+248>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001864 <pxReadyTasksLists+268>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001864 <pxReadyTasksLists+268>, pxPrevious = 0x20001864 <pxReadyTasksLists+268>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001878 <pxReadyTasksLists+288>, xListEnd = {xItemValue = 4294967295,
--Type <RET> for more, q to quit, c to continue without paging--
pxNext = 0x20001878 <pxReadyTasksLists+288>, pxPrevious = 0x20001878 <pxReadyTasksLists+288>}}, {
uxNumberOfItems = 0, pxIndex = 0x2000188c <pxReadyTasksLists+308>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x2000188c <pxReadyTasksLists+308>, pxPrevious = 0x2000188c <pxReadyTasksLists+308>}}, {
uxNumberOfItems = 0, pxIndex = 0x200018a0 <pxReadyTasksLists+328>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200018a0 <pxReadyTasksLists+328>, pxPrevious = 0x200018a0 <pxReadyTasksLists+328>}}, {
uxNumberOfItems = 0, pxIndex = 0x200018b4 <pxReadyTasksLists+348>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200018b4 <pxReadyTasksLists+348>, pxPrevious = 0x200018b4 <pxReadyTasksLists+348>}}, {
uxNumberOfItems = 0, pxIndex = 0x200018c8 <pxReadyTasksLists+368>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200018c8 <pxReadyTasksLists+368>, pxPrevious = 0x200018c8 <pxReadyTasksLists+368>}}, {
uxNumberOfItems = 0, pxIndex = 0x200018dc <pxReadyTasksLists+388>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200018dc <pxReadyTasksLists+388>, pxPrevious = 0x200018dc <pxReadyTasksLists+388>}}, {
uxNumberOfItems = 0, pxIndex = 0x200018f0 <pxReadyTasksLists+408>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200018f0 <pxReadyTasksLists+408>, pxPrevious = 0x200018f0 <pxReadyTasksLists+408>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001904 <pxReadyTasksLists+428>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001904 <pxReadyTasksLists+428>, pxPrevious = 0x20001904 <pxReadyTasksLists+428>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001918 <pxReadyTasksLists+448>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001918 <pxReadyTasksLists+448>, pxPrevious = 0x20001918 <pxReadyTasksLists+448>}}, {
uxNumberOfItems = 0, pxIndex = 0x2000192c <pxReadyTasksLists+468>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x2000192c <pxReadyTasksLists+468>, pxPrevious = 0x2000192c <pxReadyTasksLists+468>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001940 <pxReadyTasksLists+488>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001940 <pxReadyTasksLists+488>, pxPrevious = 0x20001940 <pxReadyTasksLists+488>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001954 <pxReadyTasksLists+508>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001954 <pxReadyTasksLists+508>, pxPrevious = 0x20001954 <pxReadyTasksLists+508>}}, {
uxNumberOfItems = 0, pxIndex = 0x20001968 <pxReadyTasksLists+528>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20001968 <pxReadyTasksLists+528>, pxPrevious = 0x20001968 <pxReadyTasksLists+528>}}, {
uxNumberOfItems = 0, pxIndex = 0x2000197c <pxReadyTasksLists+548>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x2000197c <pxReadyTasksLists+548>, pxPrevious = 0x2000197c <pxReadyTasksLists+548>}}, {
uxNumberOfItems = 1, pxIndex = 0x20001990 <pxReadyTasksLists+568>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200039a8 <ucHeap+5964>, pxPrevious = 0x200039a8 <ucHeap+5964>}}, {uxNumberOfItems = 0,
--Type <RET> for more, q to quit, c to continue without paging--
pxIndex = 0x200019a4 <pxReadyTasksLists+588>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x200019a4 <pxReadyTasksLists+588>, pxPrevious = 0x200019a4 <pxReadyTasksLists+588>}}, {
uxNumberOfItems = 1, pxIndex = 0x200019b8 <pxReadyTasksLists+608>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20003098 <ucHeap+3644>, pxPrevious = 0x20003098 <ucHeap+3644>}}, {uxNumberOfItems = 1,
pxIndex = 0x200019cc <pxReadyTasksLists+628>, xListEnd = {xItemValue = 4294967295,
pxNext = 0x20002c10 <ucHeap+2484>, pxPrevious = 0x20002c10 <ucHeap+2484>}}}
Although, I can see this array is defined as pxReadyTasksLists[ configMAX_PRIORITIES ];
- so I guess each “slot” in this array represents a priority, and then uxNumberOfItems
says how many tasks are there for a given priority.
If I try to reformat this array:
{
"00" {uxNumberOfItems = 2, pxIndex = 0x20001760 <pxReadyTasksLists+8>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20004fb0 <ucHeap+11604>, pxPrevious = 0x20005438 <ucHeap+12764>}},
"01" {uxNumberOfItems = 0, pxIndex = 0x20001774 <pxReadyTasksLists+28>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001774 <pxReadyTasksLists+28>, pxPrevious = 0x20001774 <pxReadyTasksLists+28>}},
"02" { uxNumberOfItems = 0, pxIndex = 0x20001788 <pxReadyTasksLists+48>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001788 <pxReadyTasksLists+48>, pxPrevious = 0x20001788 <pxReadyTasksLists+48>}},
"03" { uxNumberOfItems = 0, pxIndex = 0x2000179c <pxReadyTasksLists+68>, xListEnd = {xItemValue = 4294967295, pxNext = 0x2000179c <pxReadyTasksLists+68>, pxPrevious = 0x2000179c <pxReadyTasksLists+68>}},
"04" { uxNumberOfItems = 0, pxIndex = 0x200017b0 <pxReadyTasksLists+88>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200017b0 <pxReadyTasksLists+88>, pxPrevious = 0x200017b0 <pxReadyTasksLists+88>}},
"05" { uxNumberOfItems = 0, pxIndex = 0x200017c4 <pxReadyTasksLists+108>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200017c4 <pxReadyTasksLists+108>, pxPrevious = 0x200017c4 <pxReadyTasksLists+108>}},
"06" { uxNumberOfItems = 0, pxIndex = 0x200017d8 <pxReadyTasksLists+128>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200017d8 <pxReadyTasksLists+128>, pxPrevious = 0x200017d8 <pxReadyTasksLists+128>}},
"07" { uxNumberOfItems = 0, pxIndex = 0x200017ec <pxReadyTasksLists+148>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200017ec <pxReadyTasksLists+148>, pxPrevious = 0x200017ec <pxReadyTasksLists+148>}},
"08" { uxNumberOfItems = 0, pxIndex = 0x20001800 <pxReadyTasksLists+168>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001800 <pxReadyTasksLists+168>, pxPrevious = 0x20001800 <pxReadyTasksLists+168>}},
"09" { uxNumberOfItems = 0, pxIndex = 0x20001814 <pxReadyTasksLists+188>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001814 <pxReadyTasksLists+188>, pxPrevious = 0x20001814 <pxReadyTasksLists+188>}},
"10" { uxNumberOfItems = 0, pxIndex = 0x20001828 <pxReadyTasksLists+208>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001828 <pxReadyTasksLists+208>, pxPrevious = 0x20001828 <pxReadyTasksLists+208>}},
"11" { uxNumberOfItems = 0, pxIndex = 0x2000183c <pxReadyTasksLists+228>, xListEnd = {xItemValue = 4294967295, pxNext = 0x2000183c <pxReadyTasksLists+228>, pxPrevious = 0x2000183c <pxReadyTasksLists+228>}},
"12" { uxNumberOfItems = 0, pxIndex = 0x20001850 <pxReadyTasksLists+248>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001850 <pxReadyTasksLists+248>, pxPrevious = 0x20001850 <pxReadyTasksLists+248>}},
"13" { uxNumberOfItems = 0, pxIndex = 0x20001864 <pxReadyTasksLists+268>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001864 <pxReadyTasksLists+268>, pxPrevious = 0x20001864 <pxReadyTasksLists+268>}},
"14" { uxNumberOfItems = 0, pxIndex = 0x20001878 <pxReadyTasksLists+288>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001878 <pxReadyTasksLists+288>, pxPrevious = 0x20001878 <pxReadyTasksLists+288>}},
"15" { uxNumberOfItems = 0, pxIndex = 0x2000188c <pxReadyTasksLists+308>, xListEnd = {xItemValue = 4294967295, pxNext = 0x2000188c <pxReadyTasksLists+308>, pxPrevious = 0x2000188c <pxReadyTasksLists+308>}},
"16" { uxNumberOfItems = 0, pxIndex = 0x200018a0 <pxReadyTasksLists+328>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200018a0 <pxReadyTasksLists+328>, pxPrevious = 0x200018a0 <pxReadyTasksLists+328>}},
"17" { uxNumberOfItems = 0, pxIndex = 0x200018b4 <pxReadyTasksLists+348>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200018b4 <pxReadyTasksLists+348>, pxPrevious = 0x200018b4 <pxReadyTasksLists+348>}},
"18" { uxNumberOfItems = 0, pxIndex = 0x200018c8 <pxReadyTasksLists+368>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200018c8 <pxReadyTasksLists+368>, pxPrevious = 0x200018c8 <pxReadyTasksLists+368>}},
"19" { uxNumberOfItems = 0, pxIndex = 0x200018dc <pxReadyTasksLists+388>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200018dc <pxReadyTasksLists+388>, pxPrevious = 0x200018dc <pxReadyTasksLists+388>}},
"20" { uxNumberOfItems = 0, pxIndex = 0x200018f0 <pxReadyTasksLists+408>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200018f0 <pxReadyTasksLists+408>, pxPrevious = 0x200018f0 <pxReadyTasksLists+408>}},
"21" { uxNumberOfItems = 0, pxIndex = 0x20001904 <pxReadyTasksLists+428>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001904 <pxReadyTasksLists+428>, pxPrevious = 0x20001904 <pxReadyTasksLists+428>}},
"22" { uxNumberOfItems = 0, pxIndex = 0x20001918 <pxReadyTasksLists+448>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001918 <pxReadyTasksLists+448>, pxPrevious = 0x20001918 <pxReadyTasksLists+448>}},
"23" { uxNumberOfItems = 0, pxIndex = 0x2000192c <pxReadyTasksLists+468>, xListEnd = {xItemValue = 4294967295, pxNext = 0x2000192c <pxReadyTasksLists+468>, pxPrevious = 0x2000192c <pxReadyTasksLists+468>}},
"24" { uxNumberOfItems = 0, pxIndex = 0x20001940 <pxReadyTasksLists+488>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001940 <pxReadyTasksLists+488>, pxPrevious = 0x20001940 <pxReadyTasksLists+488>}},
"25" { uxNumberOfItems = 0, pxIndex = 0x20001954 <pxReadyTasksLists+508>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001954 <pxReadyTasksLists+508>, pxPrevious = 0x20001954 <pxReadyTasksLists+508>}},
"26" { uxNumberOfItems = 0, pxIndex = 0x20001968 <pxReadyTasksLists+528>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20001968 <pxReadyTasksLists+528>, pxPrevious = 0x20001968 <pxReadyTasksLists+528>}},
"27" { uxNumberOfItems = 0, pxIndex = 0x2000197c <pxReadyTasksLists+548>, xListEnd = {xItemValue = 4294967295, pxNext = 0x2000197c <pxReadyTasksLists+548>, pxPrevious = 0x2000197c <pxReadyTasksLists+548>}},
"28" { uxNumberOfItems = 1, pxIndex = 0x20001990 <pxReadyTasksLists+568>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200039a8 <ucHeap+5964>, pxPrevious = 0x200039a8 <ucHeap+5964>}},
"29" {uxNumberOfItems = 0, pxIndex = 0x200019a4 <pxReadyTasksLists+588>, xListEnd = {xItemValue = 4294967295, pxNext = 0x200019a4 <pxReadyTasksLists+588>, pxPrevious = 0x200019a4 <pxReadyTasksLists+588>}},
"30" { uxNumberOfItems = 1, pxIndex = 0x200019b8 <pxReadyTasksLists+608>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20003098 <ucHeap+3644>, pxPrevious = 0x20003098 <ucHeap+3644>}},
"31" {uxNumberOfItems = 1, pxIndex = 0x200019cc <pxReadyTasksLists+628>, xListEnd = {xItemValue = 4294967295, pxNext = 0x20002c10 <ucHeap+2484>, pxPrevious = 0x20002c10 <ucHeap+2484>}}
}
… I can see there are
- two tasks with priority 0 (IDLE); then
- one task with priority 31 (configMAX_PRIORITIES-1),
- one task with priority 30 (configMAX_PRIORITIES-2),
- NO tasks with priority 29 (configMAX_PRIORITIES-3) !!!,
- one task with priority 28 (configMAX_PRIORITIES-4) (this should have been the problematic
my_printer_task
)
Strangely, the priority 29 task is actually what I’ve called above “working_02_task
” - which I’ve already confirmed that it runs via the breakpoint (and it seemingly even pushes data on the queue without a problem), so I’m kinda puzzled by the fact, that the pxReadyTasksLists
has no tasks with this priority (maybe because it is not “ready”?) - unless this array changes the uxNumberOfItems dynamically depending on “ready” status …
Thanks for the assistance so far - and if there are any more suggestions, I’d love to hear them!