<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi all,<br>
I've developed the following C code with two tasks which execute a
simple printf, but<br>
only the first printf is executed, and I don't understand why... Is
there an error in my code?<br>
Thanks a lot.<br>
<br>
Luca<br>
<br>
/*<br>
* multiTask.c<br>
*<br>
* Created on: May 10, 2012<br>
* Author: Luca Cinquepalmi<br>
*/<br>
<br>
<br>
<small>#include <rtems.h><br>
<br>
#define CONFIGURE_INIT<br>
<br>
#include <bsp.h> <br>
<br>
rtems_task Init (rtems_task_argument argument); <br>
rtems_task task1 (rtems_task_argument argument);<br>
rtems_task task2 (rtems_task_argument argument);<br>
<br>
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br>
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>
<br>
#define CONFIGURE_MAXIMUM_TASKS 4<br>
<br>
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE<br>
<br>
#define CONFIGURE_EXTRA_TASK_STACKS (3 *
RTEMS_MINIMUM_STACK_SIZE)<br>
<br>
#include <rtems/confdefs.h><br>
<br>
#include <stdio.h><br>
#include <stdlib.h><br>
#include "leon.h"<br>
#include "define.h"<br>
<br>
rtems_id tid[3];<br>
rtems_name name[3];<br>
<br>
rtems_task Init(rtems_task_argument ignored)<br>
{<br>
<br>
rtems_status_code status;<br>
<br>
name[1] = rtems_build_name('A','P','P','1');<br>
name[2] = rtems_build_name('A','P','P','2');<br>
<br>
status = rtems_task_create(<br>
name[1], 1, RTEMS_MINIMUM_STACK_SIZE,<br>
RTEMS_DEFAULT_MODES,<br>
RTEMS_DEFAULT_ATTRIBUTES, &tid[1]);<br>
if ( status != RTEMS_SUCCESSFUL ) {<br>
printf( "rtems_task_create 1 failed with status of
%d.\n\r", status);<br>
exit(1);<br>
}<br>
else<br>
printf("task 1 create OK\n\r");<br>
<br>
status = rtems_task_create(<br>
name[2], 1, RTEMS_MINIMUM_STACK_SIZE,<br>
RTEMS_DEFAULT_MODES,<br>
RTEMS_DEFAULT_ATTRIBUTES, &tid[2]);<br>
if ( status != RTEMS_SUCCESSFUL ) {<br>
printf( "rtems_task_create 2 failed with status of
%d.\n\r", status);<br>
exit(1);<br>
}<br>
else<br>
printf("task 2 create OK\n\r");<br>
<br>
printf("Print of Init task!\n\r");<br>
<br>
status = rtems_task_start( tid[1], task1, 1 );<br>
if ( status != RTEMS_SUCCESSFUL ) {<br>
printf( "rtems_task_start 1 failed with status of
%d.\n\r", status);<br>
exit(1);<br>
}<br>
else<br>
printf("task 1 start OK\n\r");<br>
<br>
status = rtems_task_start( tid[2], task2, 2 );<br>
if ( status != RTEMS_SUCCESSFUL ) {<br>
printf( "rtems_task_start 2 failed with status of
%d.\n\r", status);<br>
exit(1);<br>
}<br>
else<br>
printf("task 2 start OK\n\r");<br>
<br>
status = rtems_task_delete( RTEMS_SELF );<br>
exit(1);<br>
}<br>
<br>
rtems_task task1(rtems_task_argument ignored)<br>
{<br>
printf("Task 1 printing\n\r");<br>
}<br>
<br>
rtems_task task2(rtems_task_argument ignored)<br>
{<br>
printf("Task 2 printing\n\r");<br>
}<br>
</small><br>
<br>
</body>
</html>