Forum Discussion
Altera_Forum
Honored Contributor
16 years agoAny of two projects should be a good start point to develop your own uC/OS-II application. I don't remember about template included in Nios II IDE 8.1, however in case of Nios II IDE 9.0 project "Hello MicroC/OS" creates two threads:
# include <stdio.h>
# include "includes.h"
/* Definition of Task Stacks */
# define TASK_STACKSIZE 2048
OS_STK task1_stk;
OS_STK task2_stk;
/* Definition of Task Priorities */
# define TASK1_PRIORITY 1
# define TASK2_PRIORITY 2
/* Prints "Hello World" and sleeps for three seconds */
void task1(void* pdata)
{
while (1)
{
printf("Hello from task1\n");
OSTimeDlyHMSM(0, 0, 3, 0);
}
}
/* Prints "Hello World" and sleeps for three seconds */
void task2(void* pdata)
{
while (1)
{
printf("Hello from task2\n");
OSTimeDlyHMSM(0, 0, 3, 0);
}
}
/* The main function creates two task and starts multi-tasking */
int main(void)
{
OSTaskCreateExt(task1,
NULL,
(void *)&task1_stk,
TASK1_PRIORITY,
TASK1_PRIORITY,
task1_stk,
TASK_STACKSIZE,
NULL,
0);
OSTaskCreateExt(task2,
NULL,
(void *)&task2_stk,
TASK2_PRIORITY,
TASK2_PRIORITY,
task2_stk,
TASK_STACKSIZE,
NULL,
0);
OSStart();
return 0;
}
Why you need specific diferences between two projects?