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




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