Quality RTOS & Embedded Software

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


Loading

halt in the loop in vListInsert function

Posted by zhuchunxia on June 2, 2016

I were working on porting FreeRTOSv8.2.3 to our CK610 cpu core.. the first task can work now . but it can't switch task. I trace it and find it halt in the loop in vListInsert function.

According to those comment , I check my code and exclude some case case 1. stack overflow does not happen by enable vApplicationStackOverflowHook trace function case 3. my code is simple enough and does not use queue ore semaphore case 4. my code is simple enough and does not use queue ore semaphore

But for case 2, I am not sure my design is okay or not . I doesn't set interrupt priority for my interrupt because of the interrupt controller is simple and work with MASK and CLEAR register ...so I disable/enable global interrupt by CPUSRSave() and CPUSRRestore() functions.. CPUSRSave is to save PSR register first then clear IE bit to disable interrupt CPUSRRestore is write old PSR value into PSR my application is simple, it is just to create a task which printf a string with interview 100ms. in whole system, there might be two interrupt source, they are one timer and system trap used to switch context.

the CPU core interrupt controller is a bit of different, CPU will clear IE in PSR automatically when interrupt happen. and set IE when interrtup return ..

my view seems to be good.. but it really halt in the loop ..Could you help to explain ? > > #define portDISABLEINTERRUPTS() ulPortSetIPL( 1 ) > #define portENABLEINTERRUPTS() ulPortSetIPL( 0 ) > portLONG ulPortSetIPL( portLONG x) > { > static portLONG cpusr = 0x80000100; > > if (x) > { > cpusr = CPUSRSave(); > } > else > { > CPUSRRestore(cpusr); > } > > return cpusr; > } > > void vListInsert( Listt * const pxList, ListItemt * const > pxNewListItem ) { ListItemt *pxIterator; const TickTypet > xValueOfInsertion = pxNewListItem->xItemValue; > > /* Only effective when configASSERT() is also defined, these tests > may catch > the list data structures being overwritten in memory. They will not > catch > data errors caused by incorrect configuration or use of FreeRTOS. / > listTESTLISTINTEGRITY( pxList ); > listTESTLISTITEM_INTEGRITY( pxNewListItem ); > > / Insert the new list item into the list, sorted in xItemValue > order. > > If the list already contains a list item with the same item value > then the > new list item should be placed after it. This ensures that TCB's > which are > stored in ready lists (all of which have the same xItemValue value) > get a > share of the CPU. However, if the xItemValue is the same as the back > marker > the iteration loop below will not end. Therefore the value is > checked > first, and the algorithm slightly modified if necessary. / > if( xValueOfInsertion == portMAX_DELAY ) > { > pxIterator = pxList->xListEnd.pxPrevious; > } > else > { > / *** NOTE > *********************************************************** > If you find your application is crashing here then likely causes are > listed below. In addition see > http://www.freertos.org/FAQHelp.html for > more tips, and ensure configASSERT() is defined! > http://www.freertos.org/a00110.html#configASSERT > > 1) Stack overflow - > see > http://www.freertos.org/Stacks-and-stack-overflow-checking.html > 2) Incorrect interrupt priority assignment, especially on Cortex-M > parts where numerically high priority values denote low actual > interrupt priorities, which can seem counter intuitive. See > http://www.freertos.org/RTOS-Cortex-M3-M4.html > and the definition > of configMAXSYSCALLINTERRUPTPRIORITY on > http://www.freertos.org/a00110.html > 3) Calling an API function from within a critical section or when > the scheduler is suspended, or calling an API function that does > not end in "FromISR" from an interrupt. > 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?). > > **********************************************************************/ > printk("list insert : try insert55555 rn"); > > for( pxIterator = ( ListItemt * ) &( pxList->xListEnd ); > pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = > pxIterator->pxNext ) /lint !e826 !e740 The mini list structure is > pxIterator->used as > the list end to save RAM. This is checked and valid. */ > { > / There is nothing to do here, just iterating to the wanted > insertion position. / > } > printk("list insert : try insert 888888rn"); > } > > pxNewListItem->pxNext = pxIterator->pxNext; > pxNewListItem->pxNext->pxPrevious = pxNewListItem; > pxNewListItem->pxPrevious = pxIterator; > pxIterator->pxNext = pxNewListItem; > > > / Remember which list the item is in. This allows fast removal of > the > item later. */ > pxNewListItem->pvContainer = ( void * ) pxList; > > > ( pxList->uxNumberOfItems )++; > }


halt in the loop in vListInsert function

Posted by rtel on June 6, 2016

For some reason this got stuck in moderation - but I think has since been answere in another thread.


[ 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