EmbDev.net

Forum: ARM programming with GCC/GNU tools Help me check if there is a hang in this code due to infinite loop


Author: Yee Yee (Company: Infowave) (armgcc)
Posted on:

Rate this post
0 useful
not useful
The loophere fn is definitely an infinite loop..

just want to verify concepts: if the condition is true for the all the 
"if" case, will it end up in an infinite loop that causes a hang when 
LEDB and LEDC are toggled? Loophere fn is outside the main loop whereas 
the while(1) loop is inside the main loop.


int Main(void)
#endif
{
                   :
                   :
  if(ECFG_GetCentralAddress(&pGprsCenterAddr) != COM_SUCCESS)
  {
    LoopHere();
  }

                   :
                   :

         if (ECFG_GetUserAppConfig(&recEnable,
                              &recType,
                              &oneFixMaxIntervalSec,
                              &displacementThresholdMet,
                              &gprsMaxBytesPerSendToServer,
                              &gprsSendPeriodSec,
                              &pGprsRemoteIpAddr,
                              &gprsRemotePortNum)!= COM_SUCCESS){
        //ELOG_Printf0(LOG_CRITICAL, "GetUserAppConfig() failed!");
    LoopHere();
  }

                    :
                    :
        if (EFLASH_Open(COM_SPI_PORT0, MCK/DATAFLASH_SPI_CLOCK_MHZ, 600,
                 1, 
0,DATAFLASH_TOTAL_PAGES,DATAFLASH_TOTAL_BYTES_PER_PAGE,
          DATAFLASH_TOTAL_BITS_FOR_BYTE_FIELD_IN_COMMAND) != 
COM_SUCCESS)
     {
        ELOG_Printf0(LOG_CRITICAL, "FLASH_Open failed!");
        while(1)
        {
            ELED_Action(LEDB, LED_TOGGLE);
            ETIME_DelayMsec(50);
        }
     }
                         :
                         :
}




void LoopHere(void)
{
     while(1)
     {
         ELED_Action(LEDC, LED_TOGGLE);
         ETIME_DelayMsec(50);
     }

}

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.