Quality RTOS & Embedded Software

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


Loading

freertos hanging on vListInsert

Posted by Sergio P Sider on July 7, 2009
Hi All,

I think you will nail my problem easily

I am still new to FreeRTOS, and my program is hanging always in the same line of code after random times (minutes or hours), generally with ethernet traffic.
I am using Cortex-M3 from luminary, with lwip raw.

The code always hangs on this line:

for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )

in vListInsert , filename: list.c

pxIterator->pxNext points to itself, so it hangs there.

As this code is "inside" freeRTOS, what could have causing this? Where should I look for?

Thank you very much, and sorry if it is a stupid question.
Sergio P. Sider

RE: freertos hanging on vListInsert

Posted by Richard on July 7, 2009
Just by reading the subject of your post I would guess you are using a Cortex M3 and have your interrupt priorities wrong. I would say though - read the comment directly above the line that is crashing. I have replicated it below for your convenience.


/* *** NOTE ***********************************************************
If you find your application is crashing here then likely causes are:
1) Stack overflow -
see http://www.freertos.org/Stacks-and-stack-overflow-checking.html
2) Incorrect interrupt priority assignment, especially on Cortex M3
parts where numerically high priority values denote low actual
interrupt priories, which can seem counter intuitive. See
configMAX_SYSCALL_INTERRUPT_PRIORITY on http://www.freertos.org/a00110.html
3) Calling an API function from within a critical section or when
the scheduler is suspended.
4) Using a queue or semaphore before it has been initialised or
before the scheduler has been started (are interrupts firing
before vTaskStartScheduler() has been called?).
See http://www.freertos.org/FAQHelp.html for more tips.
**********************************************************************/

for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )

Regards.

RE: freertos hanging on vListInsert

Posted by Sergio P Sider on July 7, 2009
HI RIchard,

Thanks... I think my version is outdated, because these comments do not exist on my version...
I will check it all (all I know for now it´s not a stack overflow).

Thanks again,
Sergio Sider.



RE: freertos hanging on vListInsert

Posted by Umut Tezduyar on July 7, 2009
Hi

I am having the exact same problem. Code stays in the for loop and never comes out. I was also suspicious about the stack overflow but that is not the case.

In my system, other than operating system tasks, I have one UART task and 5 more tasks with priority 1. Other than uart task, all other tasks just suspend the execution with vTaskDelay.

One final note is, just like Sergio's code, my FreeRTOS code doesn't have the comments shown by Richard.

Thanks a lot.

RE: freertos hanging on vListInsert

Posted by Richard on July 7, 2009
With the risk of just repeating myself "Just by reading the subject of your post I would guess you are using a Cortex M3 and have your interrupt priorities wrong". Neither respondent has indicated whether this is the case or not. Without further information all I can do is give you the same advice as the original poster.

Regards.

RE: freertos hanging on vListInsert

Posted by Sergio P Sider on July 7, 2009
Hi Richard,

I just confirmed that was the interrupt priority as you suggested. I forgot to set the interrupt priority of one of my interrupt handlers, so it defaults to 'whatever' and this handler was calling a API function.

BTW, I will update my version to the current one... I probably would not have to bother you if I the comments were there... ;-)

Thanks again!!!
Sergio P. SIder

RE: freertos hanging on vListInsert

Posted by Umut Tezduyar on July 7, 2009
I tried another way and it worked too.

If you are not sure about the priorities of your system yet, set configMAX_SYSCALL_INTERRUPT_PRIORITY to 0. Which will disable interrupt masking. The function that uses configMAX_SYSCALL_INTERRUPT_PRIORITY is xPortPendSVHandler.

The inliner assembler will look like this:

...
...
...
mov r0, %0
msr basepri, r0
bl vTaskSwitchContext
mov r0, #0
msr basepri, r0
ldmia sp!, {r3, r14}
...
...
...

where %0 is configMAX_SYSCALL_INTERRUPT_PRIORITY. Setting configMAX_SYSCALL_INTERRUPT_PRIORITY to 0 will execute the same instruction (msr basepri, r0) twice.

Also, I haven't seen a usage of configKERNEL_INTERRUPT_PRIORITY variable other than assigning to a constant variable in GCC port file.

Thanks Richard!


[ 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.

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