# need help to understand program

Joined Nov 24, 2011
712
Hello
I am trying to understand basic concept of RTOS. I have downloaded books. I am trying to understand. I need help on below part of program
Code:
int main( void )
{
/* Perform any hardware setup necessary. */
prvSetupHardware();
/* --- APPLICATION TASKS CAN BE CREATED HERE --- */
/* Start the created tasks running. */
/* Execution will only reach here if there was insufficient heap to
start the scheduler. */
for( ;; );
return 0;
}
anyone can help me with example

#### WBahn

Joined Mar 31, 2012
26,037
What's is it that you don't understand?

Line 4 performs any necessary hardware setup.
Line 7 starts the scheduler which schedules the tasks that you created starting on Line 5. This function should never end.
Line 10 should only be reached if the schedule ends, and so the program traps in an infinite loop.
Line 11 should never be reached, but it is needed because main() is declared as returning an int.

Dowloading books isn't enough. You need to also read and study them.

Joined Nov 24, 2011
712
What's is it that you don't understand?
what is meaning of necessary hardware setup. does it mean to set the memory ,counter ...etc

#### MrChips

Joined Oct 2, 2009
21,628
what is meaning of necessary hardware setup. does it mean to set the memory ,counter ...etc
In just about every controller, choices have to be selected by the programmer.
For example, as a trivial but necessary example, is the pin on the chip you plan to use, is it going to be an input pin or an output pin?

#### WBahn

Joined Mar 31, 2012
26,037
what is meaning of necessary hardware setup. does it mean to set the memory ,counter ...etc
It means pretty much what it says. If a pin needs to be an input, then the part needs to be configured to make that happen. There are probably numerous things that need to be configured. There may also need to be some global variables that need to be created. It all depends on both your hardware and your application.