Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

FreeRTOS EFM32 TCB PC value location

Posted by Dimitry on September 11, 2011
Hi,

FreeRTOS7.0.1.
Cortex-M3 (EnergyMicro)

I have added an array of pointers to the top of the stack for each task for debugging purposes (some of tasks are stick). Would you like to help me to find the last program counter (PC) value, stored in stack after task context is switched?

Thank you!

RE: FreeRTOS EFM32 TCB PC value location

Posted by Richard on September 11, 2011
What do you mean "some of tasks are stuck"? Is it that a task that was running does not run any more?

What is it you are trying to achieve?

Which compiler are you using?

Regards.

RE: FreeRTOS EFM32 TCB PC value location

Posted by Dimitry on September 11, 2011
Yes, some of tasks that was running does not run any more.
I'm trying to determine address of the last instruction that is executed in the task, before scheduler has switched to another task.
I use IAR32 compiler for ARM.

Thank you.

RE: FreeRTOS EFM32 TCB PC value location

Posted by Richard on September 11, 2011
Probably the best place to start is to use the FreeRTOS plug in for IAR. If you are using a recent version of IAR then it will already be installed. The plug in will tell you the state of every task, the location of the top of its stack, and which queue/semaphore the task is blocked of (if it is in the Blocked state).

Regards.

RE: FreeRTOS EFM32 TCB PC value location

Posted by Dimitry on September 11, 2011
This solution is a bit complicated for me, because my problem does not occur periodically (by accident) with a long interval of time (days) and not in each of device, that my software is run.
Therefore, I run a lot of devices, and if in any of device the problem is occurred, the device will send "dump" of debug info (include PC value) through UART..

I prefer to determine address of the last instruction that is executed in the task in Run-Time and add it to the "dump" of my debug info.

Thank you.

RE: FreeRTOS EFM32 TCB PC value location

Posted by Richard on September 11, 2011
When the task that is "stuck" gets stuck, does the rest of the system continue executing? If so, then the stuck task cannot itself be in the Running state. You could then use the traceTASK_SWITCHED_OUT() macro to log some data about each task as it is switched out of the Running state - how useful that is would be debatable though. For example:

1) If the task is switched out because it yields, the last instruction it executes will always be in the yield function, and that tells you nothing about why it was yielding. You could get around that by using more trace macros to also log data about why yield was called (for example, was it a block on a queue, or because vTaskDelay() was called, etc.).

2) If a task no longer runs it might be because a completely different task is using all the CPU time, and starving it of any time itself.

Regards.

RE: FreeRTOS EFM32 TCB PC value location

Posted by Dimitry on September 11, 2011
The problem begins with a specific task (I know his identity). From the outside it looks like the task does not respond to messages. System has enough CPU time (IDLE task is invoked periodically). I will I try to use trace macros to get more debugging information.

Thank you.


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


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner