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



Posted by bsder on November 5, 2015

I'm trying to hunt down a really pernicious bug, and could use a little advice.

I'm running on a PIC32MX on FreeRTOS 8.2.3 (problem exists in 8.0.1 which is what I was originally using but I upgraded just in case), and I'm seeing an assert fire when I plug in my USB--but only in release mode. If I'm in debug mode, everything works just dandy. I had to rig up special code to shove debug info out a port that I could actually probe while in full release mode.

This is really infuriating. Now, that kind of behavior screams "smasher" (stack/heap/runaway variable init). I am hitting a configASSERT( uxTopReadyPriority );

My questions:

1) What is that ASSERT checking? 2) What does failing that ASSERT mean? 3) What in the world could cause that ASSERT to fire?

Any advice is appreciated.

Thanks, -a

The code that is tripping is this from tasks.c:

~~~~ #define taskSELECTHIGHESTPRIORITYTASK() { /* Find the highest priority queue that contains ready tasks. */ while( listLISTISEMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) ) { configASSERT( uxTopReadyPriority ); --uxTopReadyPriority; } /* listGETOWNEROFNEXTENTRY indexes through the list, so the tasks of the same priority get an equal share of the processor time. */ listGETOWNEROFNEXTENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) ); } /* taskSELECTHIGHESTPRIORITYTASK */



Posted by rtel on November 5, 2015

1) What is that ASSERT checking? 2) What does failing that ASSERT mean? 3) What in the world could cause that ASSERT to fire?

There should always be one task that is able to run. Normally this is the RTOS idle task. If that assert is being hit then, as far as the RTOS is concerned, there are no tasks it can select to enter the Running state as even the list containing idle priority tasks is empty.

This can happen because of a simple data corruption somewhere in the RTOS's internal data structures.

Normally I would suggest reading through the following list http://www.freertos.org/FAQHelp.html to see if you are complying with all the recommendations, ensuring the interrupt priorities are set correctly (an incorrect interrupt priority is a classic cause for this type of symptom), etc. In this case it is more interesting that the debug build works though, so in addition you would have to consider whether there is anything in the application or driver/usb code that might cause a problem with faster execution, or missing 'volatile' qualifiers, etc.

[ 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