This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What will happen if we remove the for(;;); from the main in the freeRTOS kernel??

Actually I read from the Mastering in the FreeRTOS documentation that,

/* If all is well then main() will never reach here as the scheduler will
now be running the tasks. If main() does reach here then it is likely that
there was insufficient heap memory available for the idle task to be created.
Chapter 2 provides more information on heap memory management. */
for( ;; );

what if I removed for( ;; ); from the main? I mean in case if anything happens in the project and if the control goes to that infinite loop then the product will hang forever.

So my question is why we use this?? can we remove it??

Parents
  • I got the answer on the FreeRTOS forum

    What happens when you exit an embedded program is only defined by a particular implementation. Some may restart the program, but many just loop to stall. In any case, your program had a major failure where the system didn’t start up, and retrying is unlikely to change that. Ideally you want it easy to see what happened when debugging, so having the loop right there is helpfull.

Reply
  • I got the answer on the FreeRTOS forum

    What happens when you exit an embedded program is only defined by a particular implementation. Some may restart the program, but many just loop to stall. In any case, your program had a major failure where the system didn’t start up, and retrying is unlikely to change that. Ideally you want it easy to see what happened when debugging, so having the loop right there is helpfull.

Children
No data