-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.c
More file actions
116 lines (86 loc) · 2.32 KB
/
Copy pathmain.c
File metadata and controls
116 lines (86 loc) · 2.32 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* main.c
*
* Created by Joe Schaack on 2/16/11.
*
*/
#include <stdio.c>
#include "uart.h"
#include <cpu_init.h>
#include "taskHandles.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "croutine.h"
#include "ledTask.h"
#include "stack_checker.h"
void vTaskPrint(void *pvParameters);
int main (void)
{
TASKHANDLES System; // Should contain all OS Handles
cpuInit();
uartInit(BAUDRATE);
xTaskCreate( vTaskPrint , (const signed portCHAR * const) "cnt", configMINIMAL_STACK_SIZE, &System, 3, &System.task.cnt);
xTaskCreate( ledTask , (const signed portCHAR * const) "led", configMINIMAL_STACK_SIZE, &System, 3, &System.task.ledTask);
xTaskCreate( stack_checker , (const signed portCHAR * const) "stack_check", 500, &System, 3, &System.task.stack_checker);
printf("Starting OS!!\n");
vTaskStartScheduler(); // does not return
printf("ERROR END");
while(1);
}
//// /**************************************************************************/
//// /*!
//// @brief Sends a single byte over UART.
////
//// @param[in] byte
//// Byte value to send
//// */
//// /**************************************************************************/
//// void __putchar(const char c)
//// {
//// uartSend(c);
//// }
////
//// /**************************************************************************/
//// /*!
//// @brief Sends a single byte over UART.
////
//// @param[in] byte
//// Byte value to send
//// */
//// /**************************************************************************/
//// int puts(const char * str)
//// {
//// int i =0;
//// while(*str)
//// {
//// __putchar(*str++);
//// i++;
//// }
//// return i;
//// }
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName )
{
puts("Stack overflow in thread: ");
puts((char *)pcTaskName);
puts("\n");
while(1);
}
void HardFault_Handler (void)
{printf("ERRRRRRR");
while(1);
}
void vApplicationIdleHook( void )
{
__WFI();
}
void vTaskPrint(void *pvParameters)
{
int cnt = 0;
while(1)
{
printf("cnt = %d\n",cnt++);
vTaskDelay((configTICK_RATE_HZ/2));//*200/1000);
}
}
//