Commit dfd61dd5 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
Browse files

Added a non-FPU task in the example

parent f03cf5d7
Pipeline #58 skipped
...@@ -25,11 +25,12 @@ endif ...@@ -25,11 +25,12 @@ endif
# Your source files: regardless of where they reside in the source tree, # Your source files: regardless of where they reside in the source tree,
# VPATH will locate them... # VPATH will locate them...
NONFPU_SRC= \ NONFPU_SRC= \
init.c init.c
FPU_SRC= \ FPU_SRC= \
task1.c task1.c \
task2.c
# Build a Dependency list and an Object list, by replacing the .c # Build a Dependency list and an Object list, by replacing the .c
# extension to .d for dependency files, and .o for object files. # extension to .d for dependency files, and .o for object files.
......
...@@ -25,9 +25,9 @@ rtems_task Init(rtems_task_argument argument) ...@@ -25,9 +25,9 @@ rtems_task Init(rtems_task_argument argument)
Task_name[i], Task_name[i],
(rtems_task_priority) 2, (rtems_task_priority) 2,
RTEMS_MINIMUM_STACK_SIZE, RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES, // use RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE for Linux/Windows like RTEMS_DEFAULT_MODES, // use RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE for Linux/Windows like
// handling of tasks with same priority (i.e. pre-emption) // handling of tasks with same priority (i.e. pre-emption)
RTEMS_FLOATING_POINT, // use RTEMS_DEFAULT_ATTRIBUTES for non-native FPU tasks i == 0 ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[i]); &Task_id[i]);
if (status != RTEMS_SUCCESSFUL) { if (status != RTEMS_SUCCESSFUL) {
printf("Failed to rtems_task_create... status:%0x\n", status); printf("Failed to rtems_task_create... status:%0x\n", status);
...@@ -37,7 +37,7 @@ rtems_task Init(rtems_task_argument argument) ...@@ -37,7 +37,7 @@ rtems_task Init(rtems_task_argument argument)
// Start Task // Start Task
status = rtems_task_start( status = rtems_task_start(
Task_id[i], Task_id[i],
Task_EntryPoint, i == 0 ? Task1_EntryPoint : Task2_EntryPoint,
i); i);
} }
printf("Parent task sleeps for a second...\n"); printf("Parent task sleeps for a second...\n");
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
#include <rtems/rtems/tasks.h> #include <rtems/rtems/tasks.h>
rtems_task Init(rtems_task_argument argument); rtems_task Init(rtems_task_argument argument);
rtems_task Task_EntryPoint(rtems_task_argument argument); rtems_task Task1_EntryPoint(rtems_task_argument argument);
rtems_task Task2_EntryPoint(rtems_task_argument argument);
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 64 #define CONFIGURE_MAXIMUM_TASKS 64
......
#include "system.h" #include "system.h"
#include <stdio.h> #include <stdio.h>
rtems_task Task_EntryPoint(rtems_task_argument argument) rtems_task Task1_EntryPoint(rtems_task_argument argument)
{ {
int task_no = (int) argument; int task_no = (int) argument;
printf("Inside task %d...\n", task_no); printf("Inside task %d...\n", task_no);
......
#include "system.h"
#include <stdio.h>
rtems_task Task2_EntryPoint(rtems_task_argument argument)
{
int task_no = (int) argument;
printf("Inside task %d...\n", task_no);
fflush(stdout);
//rtems_task_wake_after(100);
int j;
long long int dummy = 0;
for(j=0; j<100000; j++) {
int k;
for(k=0; k<100; k++)
dummy ^= k;
dummy++;
}
printf("Computed value by task %d was %lld\n", task_no, dummy);
rtems_task_delete(RTEMS_SELF);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment