Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


Howto find a blocked task's whereabouts?

Posted by M Beronius on May 23, 2011
Is there a way to parse the task stack to get to know where a particular task is at a given state?

I have a task that stops executing (comes up as blocked in the task list), and I need to know why/on what it is waiting.

I guess this can be done with the stateviewer, but afaict, I don't have the correct (supported) eclipse environment for stateviewer. (I am using CodeSourcery GCC on Coldfire V2).

RE: Howto find a blocked task's whereabouts?

Posted by Dave on May 23, 2011
The task stack can be inspected, but how things are placed on the stack is very port dependent. You will have to look at the compiler and CPU manuals or the portSAVE_CONTEXT() definition to see where the program counter is saved.

Another option is to use the trace macros to record what that task is doing. You can define the trace macro so it only records information when the pxCurrentTCB is equal to the handle of the task you are interested in.

RE: Howto find a blocked task's whereabouts?

Posted by M Beronius on May 23, 2011
Trace macros may be a way forward (thanks, I have not thought about that!) but as this only happens ever so often, so ideally for me, a post-mortem solution is the preferred way forward here.

There's no other way to know, maybe from the os point of view, what a particular task is blocking on?


RE: Howto find a blocked task's whereabouts?

Posted by Dave on May 23, 2011
If the task is blocked on a queue or semaphore then the state viewer will give you the queue or semaphore handle, and then you can cross check the handle in the state viewer to get the queue or semaphore name (if the queue or semaphore has been registered).

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists