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);
47 * OpenPilot Main function:
50 * Create the "System" task (SystemModInitializein Modules/System/systemmod.c) <BR>
51 * Start FreeRTOS Scheduler (vTaskStartScheduler) (Now handled by caller)
52 * If something goes wrong, blink LED1 and LED2 every 100ms
57 /* NOTE: Do NOT modify the following start-up sequence */
58 /* Any new initialization functions should be added in OpenPilotInit() */
60 /* Brings up System using CMSIS functions, enables the LEDs. */
63 /* Architecture dependant Hardware and
64 * core subsystem initialisation
65 * (see pios_board.c for your arch)
69 /* Initialize modules */
71 /* swap the stack to use the IRQ stack */
74 /* Start the FreeRTOS scheduler which should never returns.*/
75 vTaskStartScheduler();
77 /* If all is well we will never reach here as the scheduler will now be running. */
79 /* Do some indication to user that something bad just happened */
81 #if defined(PIOS_LED_HEARTBEAT)
82 PIOS_LED_Toggle(PIOS_LED_HEARTBEAT
);
83 #endif /* PIOS_LED_HEARTBEAT */
84 PIOS_DELAY_WaitmS(100);