EmbDev.net

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


von Yee Y. (Company: Infowave) (armgcc)


Rate this post
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);
     }

}

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.