aboutsummaryrefslogtreecommitdiffstats
path: root/boards/base/RaspberryPi/FreeRTOS/freertos_main.c
blob: 821a679b52ea2a7645df56d6ea54d981f8c6cc23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <FreeRTOS.h>
#include <task.h>

#include "Drivers/interrupts.h"

extern int main(void);

static void mainTask(void *pvParameters) {
	(void)	pvParameters;
	main();
}

/**
 *	This is the systems main entry, some call it a boot thread.
 **/
int FreeRTOS_Main(void) {

	DisableInterrupts();
	InitInterruptController();

   xTaskCreate(mainTask,
			  (portCHAR *)"Main Task",
			  128,
			  NULL, 
			  0, 
			  NULL);

	vTaskStartScheduler();

	/*
	 *	We should never get here, but just in case something goes wrong,
	 *	we'll place the CPU into a safe loop.
	 */
	while(1) {
		;
	}
	
	return 0;
}

void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
{
	( void ) pcTaskName;
	( void ) pxTask;

	/* Run time task stack overflow checking is performed if
	configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2.  This hook	function is 
	called if a task stack overflow is detected.  Note the system/interrupt
	stack is not checked. */
	taskDISABLE_INTERRUPTS();
	for( ;; );
}
/*-----------------------------------------------------------*/

void vApplicationTickHook( void )
{
	/* This function will be called by each tick interrupt if
	configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h.  User code can be
	added here, but the tick hook is called from an interrupt context, so
	code must not attempt to block, and only the interrupt safe FreeRTOS API
	functions can be used (those that end in FromISR()). */
}