2 ******************************************************************************
3 * @addtogroup OpenPilotSystem OpenPilot System
4 * @brief These files are the core system files of OpenPilot.
5 * They are the ground layer just above PiOS. In practice, OpenPilot actually starts
6 * in the main() function of openpilot.c
8 * @addtogroup OpenPilotCore OpenPilot Core
9 * @brief This is where the OP firmware starts. Those files also define the compile-time
10 * options of the firmware.
13 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
14 * @brief Sets up and runs main OpenPilot tasks.
15 * @see The GNU Public License (GPL) Version 3
17 *****************************************************************************/
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 3 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful, but
25 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #include "inc/openpilot.h"
35 #include <uavobjectsinit.h>
36 #include <hwsettings.h>
37 #include <pios_board_init.h>
40 #define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
42 /* Global Variables */
44 extern void Stack_Change(void);
45 extern void GPSPSystemModStart(void);
48 * OpenPilot Main function:
51 * Create the "System" task (SystemModInitializein Modules/System/systemmod.c) <BR>
52 * Start FreeRTOS Scheduler (vTaskStartScheduler) (Now handled by caller)
53 * If something goes wrong, blink LED1 and LED2 every 100ms
58 /* Brings up System using CMSIS functions, enables the LEDs. */
62 * Initialize the system module, which configures the board and
63 * starts the other modules.
67 /* swap the stack to use the IRQ stack */
70 /* Start the FreeRTOS scheduler */
71 vTaskStartScheduler();
73 /* If all is well we will never reach here as the scheduler will now be running. */
75 /* Do some indication to user that something bad just happened */
77 #if defined(PIOS_LED_HEARTBEAT)
78 PIOS_LED_Toggle(PIOS_LED_HEARTBEAT
);
79 #endif /* PIOS_LED_HEARTBEAT */
80 PIOS_DELAY_WaitmS(100);