Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7673953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:37:47+00:00 2026-05-31T16:37:47+00:00

I’m trying to understand why my code get stuck in the for loop of

  • 0

I’m trying to understand why my code get stuck in the for loop of vListInsert from FreeRTOS.
I’m implementing FreeRTOS for bfin561 coreb with gcc toolchain compiler.

here are the clue I’ve got:

I initialise the semaphore this way:

.....
 vSemaphoreCreateBinary( LED0_semaphore );
        vSemaphoreCreateBinary( LED5_semaphore );
    params[0].event = LED0_semaphore;
        params[5].event = LED5_semaphore;
....

then in the task function:

static portTASK_FUNCTION(LED_blink_thread, Param)
{

        coreb_msg("start LED_blink_thread\n");

    task_params_list_t *p = (task_params_list_t *)Param;

        coreb_msg("got parameters\n");

        int lite = p->LED;
        xSemaphoreHandle sem = p->event;
   if (sem != (xSemaphoreHandle)0)                                     // is t\
he semaphore pointer is valid                                                   
        {
            coreb_msg("semaphore pointer is valid\n");

                while(1)
                {
                  // Button task: sem is non-NULL, pend on it for ever        
                    while( xSemaphoreTake( sem, portMAX_DELAY ) != pdTRUE ); 
                    coreb_msg("semaphore is non-NULL SET LED\n");

                    EZKit_Set_LED(lite); // turn on a single LED passed as arg.                                 

                    while( xSemaphoreTake( sem, portMAX_DELAY ) != pdTRUE );
                    coreb_msg("semaphore is non-NULL CLEAR LED\n");

                    EZKit_Clear_LED(lite);   
.....

}

in the above code the problem hapen in the second while( xSemaphoreTake( sem, portMAX_DELAY ) != pdTRUE ); line.

Debugging through the code, I got stuck in :

void vListInsert( xList *pxList, xListItem *pxNewListItem )

from freeRTOS at the:

....
for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIter ator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
                {
                    coreb_msg("iterate");
                    coreb_msg("pxIterator = %x",pxIterator);
                    coreb_msg("pxIterator->pxNext->xItemValue = %x",pxIterator->pxNext->xItemValue);
                    coreb_msg("pxIterator->pxNext = %x",pxIterator->pxNext);


            /* There is nothing to do here, we are just iterating to the                                                                           
                        wanted insertion position. */
                }
  ....

outputting debug messages I’ve got:

COREB: get owner of next entry:                                                 
COREB: current TCB 3d24000                                                      
COREB: pxReadyTasksLists[ uxTopReadyPriority ] = 1                              
COREB: TCB content:                                                             
COREB: top of stack: 3d25588                                                    
COREB: GenericListItem: 0                                                       
COREB: Event ListItem: 4                                                        
COREB: Priority: 6                                                              
COREB: start of stack: 3d25000                                                  
COREB: Task Name: LED tas                                                       
COREB: TCB number: 7                                                            
COREB: Task Tag: 3c06a88                                                        
COREB: trace switched in:LED tas                                                
COREB: write trace to buffer                                                    
COREB: call task hook                                                           
COREB: Task call app hook called    
COREB: Task call app hook called                                                
COREB: start LED_blink_thread                                                   
COREB: got parameters                                                           
COREB: semaphore pointer is valid                                               
COREB: start xQueueGenericReceive                                               
COREB: addr pxQueue = 3d18000                                                   
COREB: addr pxQueue->msgWait = 3d18038                                          
COREB: pxQueue Is Not Null                                                      
COREB: pxQueue->MsgW Is Not Null                                                
COREB: queue message waiting                                                    
COREB: pxQueue->pcReadFrom = 3d19000                                            
COREB: BUG dst 00000000 src 03d19000                                            
COREB: copy data from queue                                                     
COREB: just peaking is false                                                    
COREB: removing data                                                            
COREB: exit critical                                                            
COREB: semaphore is non-NULL SET LED                                            
COREB: start xQueueGenericReceive                                               
COREB: addr pxQueue = 3d18000                                                   
COREB: addr pxQueue->msgWait = 3d18038                                          
COREB: pxQueue Is Not Null         
COREB: pxQueue->MsgW Is Null                                                    
COREB: there is no data in queue                                                
COREB: The queue was empty and a block time specified                           
COREB: set timout out 0                                                         
COREB: all task suspended                                                       
COREB: prvLockQueue called                                                      
COREB: check timeout = false                                                    
COREB: queue is empty                                                           
COREB: before TaskPlaceOnEventList                                              
COREB: call vListInsert       
COREB: start list insert                                                        
COREB: xValueOfInsertion = 4                                                    
COREB: portMAX_DELAY = ffff                                                     
COREB: xValueOfInsertion != portMAX_DELAY                                       
COREB: pxNewListItem->pxNext = 3d1802c                                          
COREB: pxNewListItem->pxNext->pxPrevious = 3d24018                              
COREB: pxNewListItem->pxPrevious = 3d1802c                                      
COREB: pxIterator->pxNext = pxNewListItem                                       
COREB: pxNewListItem->pvContainer = pxList                                      
COREB: pxList->uxNumberOfItems = 1                                              
COREB: call vListRemove                                                         
COREB: list_rem px prev: 3c0cea0                                                
COREB: list_rem px next: 3d24004                                                
COREB: vTaskSuspend == 1                                                        
COREB: xTicksToWait == portMAX_DELAY             
COREB: call  vListInsertEnd                                                     
COREB: before unlock queue                                                      
COREB: task resume all failed                                                   
COREB: there is no data in queue                                                
COREB: all task suspended                                                       
COREB: prvLockQueue called                                                      
COREB: check timeout = false                                                    
COREB: queue is empty                                                           
COREB: before TaskPlaceOnEventList                                              
COREB: call vListInsert                                                         
COREB: start list insert                                                        
COREB: xValueOfInsertion = 4                                                    
COREB: portMAX_DELAY = ffff                                                     
COREB: xValueOfInsertion != portMAX_DELAY                                       
COREB: iterate                  
COREB: pxIterator = 3d1802c                                                     
COREB: pxIterator->pxNext->xItemValue = 4                                       
COREB: pxIterator->pxNext = 3d24018                                             
COREB: pxNewListItem->pxNext = 3d1802c                                          
COREB: pxNewListItem->pxNext->pxPrevious = 3d24018                              
COREB: pxNewListItem->pxPrevious = 3d24018                                      
COREB: pxIterator->pxNext = pxNewListItem                                       
COREB: pxNewListItem->pvContainer = pxList                                      
COREB: pxList->uxNumberOfItems = 2                                              
COREB: call vListRemove                                                         
COREB: list_rem px prev: 3c0cf48                                                
COREB: list_rem px next: 3d24004                                                
COREB: vTaskSuspend == 1                                                        
COREB: xTicksToWait == portMAX_DELAY                                            
COREB: call  vListInsertEnd                                                     
COREB: before unlock queue                                                      
COREB: task resume all failed                                                   
COREB: there is no data in queue                                                
COREB: all task suspended                                                       
COREB: prvLockQueue called     
COREB: check timeout = false                                                    
COREB: queue is empty                                                           
COREB: before TaskPlaceOnEventList                                              
COREB: call vListInsert                                                         
COREB: start list insert                                                        
COREB: xValueOfInsertion = 4                                                    
COREB: portMAX_DELAY = ffff                                                     
COREB: xValueOfInsertion != portMAX_DELAY                                       
COREB: iterate                                                                  
COREB: pxIterator = 3d1802c                                                     
COREB: pxIterator->pxNext->xItemValue = 4                                       
COREB: pxIterator->pxNext = 3d24018                                             
COREB: pxNewListItem->pxNext = 3d1802c                                          
COREB: pxNewListItem->pxNext->pxPrevious = 3d24018
COREB: pxNewListItem->pxPrevious = 3d24018                                      
COREB: pxIterator->pxNext = pxNewListItem                                       
COREB: pxNewListItem->pvContainer = pxList                                      
COREB: pxList->uxNumberOfItems = 2                                              
COREB: call vListRemove                                                         
COREB: list_rem px prev: 3c0cf48                                                
COREB: list_rem px next: 3d24004                                                
COREB: vTaskSuspend == 1                                                        
COREB: xTicksToWait == portMAX_DELAY                                            
COREB: call  vListInsertEnd                                                     
COREB: before unlock queue                                                      
COREB: task resume all failed                                                   
COREB: there is no data in queue                                                
COREB: all task suspended                                                       
COREB: prvLockQueue called                                                      
COREB: check timeout = false                                                    
COREB: queue is empty                                                           
COREB: before TaskPlaceOnEventList                                              
COREB: call vListInsert                                                         
COREB: start list insert                           
COREB: xValueOfInsertion = 4                                                    
COREB: portMAX_DELAY = ffff                                                     
COREB: xValueOfInsertion != portMAX_DELAY                                       
COREB: iterate                                                                  
COREB: pxIterator = 3d1802c                                                     
COREB: pxIterator->pxNext->xItemValue = 4                                       
COREB: pxIterator->pxNext = 3d24018                                             
COREB: iterate                                                                  
COREB: pxIterator = 3d24018                                                     
COREB: pxIterator->pxNext->xItemValue = 4                                       
COREB: pxIterator->pxNext = 3d24018                                             
COREB: iterate                                                                  
COREB: pxIterator = 3d24018                                                     
COREB: pxIterator->pxNext->xItemValue = 4                                       
COREB: pxIterator->pxNext = 3d24018                                             
COREB: iterate                                                                  
COREB: pxIterator = 3d24018                                                     
COREB: pxIterator->pxNext->xItemValue = 4                                       
COREB: pxIterator->pxNext = 3d24018                                             
COREB: iterate                         
....

and it stay in this for loop.

Any one that knw well freeRTOS could tell me what happen? There some comment above this for loop function in the FreeRTOS code about certain reason why it would crash, but it doesn’t seem to be that or if it is I don’t know how to solve it for the moment.

Thanks,

William

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:37:48+00:00Added an answer on May 31, 2026 at 4:37 pm

    It appears you’re not giving the semaphore back anywhere – that would make the 2nd xSemaphoreTake hang up

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to loop through a bunch of documents I have to put
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.