update credits
[librepilot.git] / flight / targets / boards / ccf3d / firmware / main.cpp
blob937a44efb820be09cbf671833a4faab0a802a236
1 /**
2 ******************************************************************************
3 * @addtogroup LibrePilotSystem LibrePilot System
4 * @{
5 * @addtogroup LibrePilotCore LibrePilot Core
6 * @brief This is where the LP firmware starts. Those files also define the compile-time
7 * options of the firmware.
8 * @{
9 * @file main.cpp
10 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
11 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2015
12 * @brief Sets up and runs main tasks.
13 * @see The GNU Public License (GPL) Version 3
15 *****************************************************************************/
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 * for more details.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 extern "C" {
33 #include "inc/openpilot.h"
34 #include <systemmod.h>
35 /* Task Priorities */
37 /* Global Variables */
38 extern void Stack_Change(void);
39 } /* extern "C" */
41 /**
42 * OpenPilot Main function:
44 * Initialize PiOS<BR>
45 * Create the "System" task (SystemModInitializein Modules/System/systemmod.c) <BR>
46 * Start FreeRTOS Scheduler (vTaskStartScheduler) (Now handled by caller)
47 * If something goes wrong, blink LED1 and LED2 every 100ms
50 int main()
52 /* NOTE: Do NOT modify the following start-up sequence */
53 /* Any new initialization functions should be added in OpenPilotInit() */
55 vPortInitialiseBlocks();
57 /* Brings up System using CMSIS functions, enables the LEDs. */
58 PIOS_SYS_Init();
61 SystemModStart();
63 /* Start the FreeRTOS scheduler, which should never return.
65 * NOTE: OpenPilot runs an operating system (FreeRTOS), which constantly calls
66 * (schedules) function files (modules). These functions never return from their
67 * while loops, which explains why each module has a while(1){} segment. Thus,
68 * the OpenPilot software actually starts at the vTaskStartScheduler() function,
69 * even though this is somewhat obscure.
71 * In addition, there are many main() functions in the OpenPilot firmware source tree
72 * This is because each main() refers to a separate hardware platform. Of course,
73 * C only allows one main(), so only the relevant main() function is compiled when
74 * making a specific firmware.
77 vTaskStartScheduler();
79 /* If all is well we will never reach here as the scheduler will now be running. */
81 /* Do some indication to user that something bad just happened */
82 while (1) {
83 #if defined(PIOS_LED_HEARTBEAT)
84 PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
85 #endif /* PIOS_LED_HEARTBEAT */
86 PIOS_DELAY_WaitmS(100);
89 return 0;
92 /**
93 * @}
94 * @}