From 6feb19843725f9d4e852050b473eebe69c6eae9a Mon Sep 17 00:00:00 2001 From: Laura Sebesta Date: Fri, 20 Apr 2012 17:10:16 -0400 Subject: [PATCH] Improved comment message, aimed at beginners. --- flight/CopterControl/System/coptercontrol.c | 15 ++++++++++++++- flight/OpenPilot/System/openpilot.c | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/flight/CopterControl/System/coptercontrol.c b/flight/CopterControl/System/coptercontrol.c index 3c64141ec..da98e9407 100644 --- a/flight/CopterControl/System/coptercontrol.c +++ b/flight/CopterControl/System/coptercontrol.c @@ -84,7 +84,20 @@ int main() /* swap the stack to use the IRQ stack */ Stack_Change(); - /* Start the FreeRTOS scheduler which should never returns.*/ + /* Start the FreeRTOS scheduler, which should never return. + * + * NOTE: OpenPilot runs an operating system (FreeRTOS), which constantly calls + * (schedules) function files (modules). These functions never return from their + * while loops, which explains why each module has a while(1){} segment. Thus, + * the OpenPilot software actually starts at the vTaskStartScheduler() function, + * even though this is somewhat obscure. + * + * In addition, there are many main() functions in the OpenPilot firmware source tree + * This is because each main() refers to a separate hardware platform. Of course, + * C only allows one main(), so only the relevant main() function is compiled when + * making a specific firmware. + * + */ vTaskStartScheduler(); /* If all is well we will never reach here as the scheduler will now be running. */ diff --git a/flight/OpenPilot/System/openpilot.c b/flight/OpenPilot/System/openpilot.c index affe65926..ddcd7d372 100644 --- a/flight/OpenPilot/System/openpilot.c +++ b/flight/OpenPilot/System/openpilot.c @@ -104,7 +104,20 @@ int main() /* swap the stack to use the IRQ stack (does nothing in sim mode) */ Stack_Change_Weak(); - /* Start the FreeRTOS scheduler which should never returns.*/ + /* Start the FreeRTOS scheduler, which should never return. + * + * NOTE: OpenPilot runs an operating system (FreeRTOS), which constantly calls + * (schedules) function files (modules). These functions never return from their + * while loops, which explains why each module has a while(1){} segment. Thus, + * the OpenPilot software actually starts at the vTaskStartScheduler() function, + * even though this is somewhat obscure. + * + * In addition, there are many main() functions in the OpenPilot firmware source tree + * This is because each main() refers to a separate hardware platform. Of course, + * C only allows one main(), so only the relevant main() function is compiled when + * making a specific firmware. + * + */ vTaskStartScheduler(); /* If all is well we will never reach here as the scheduler will now be running. */