Very strange bug

Pascal Chevochot Pascal.Chevochot at irisa.fr
Fri Jun 15 13:45:43 UTC 2001


Hello,

Below, you can find a short program. With rtems 4.5.0/bsp586, it works
fine. But if I uncomment line `printf("2\n");', then this programm
badly crashes !!! Now, if I replace `printf' by `puts', it works !!!

Could someone make this test on another bsp586 ?

Pascal.

------- begin ----------
#include <rtems.h>

extern rtems_task Init(rtems_task_argument arg);

#define CONFIGURE_INIT
#include <bsp.h> /* for device driver prototypes */

#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER

#define CONFIGURE_MAXIMUM_TASKS            10

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM

#include <confdefs.h>

#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>

rtems_task mainThread(rtems_task_argument arg)
{
  uint tid;
  rtems_status_code r;

  tid=arg&65535;

  printf("id\n");

  r=rtems_task_suspend(RTEMS_SELF);
  assert(r==RTEMS_SUCCESSFUL);
  printf("wakeup\n");
  while (1);
}

/*+
  Main.
+*/
rtems_task Init(rtems_task_argument arg)
{
  {
    rtems_status_code r;
    rtems_name name;
    rtems_id tid[10];
    int i=0;
  
    name=rtems_build_name('T','0','0','0');
    r=rtems_task_create(name,100,4096,RTEMS_NO_PREEMPT,RTEMS_FLOATING_POINT,tid+i);
    if (r != RTEMS_SUCCESSFUL)
      printf("->%d\n",r);
    assert(r==RTEMS_SUCCESSFUL);
    r=rtems_task_start(tid[i],mainThread,(rtems_task_argument)i);
    assert(r==RTEMS_SUCCESSFUL);
    printf("1\n");
    r=rtems_task_wake_after(100);
    assert(r==RTEMS_SUCCESSFUL);
    printf("2\n");
    r=rtems_task_is_suspended(tid[i]);
    assert(r==RTEMS_ALREADY_SUSPENDED);
    r=rtems_task_resume(tid[0]);
    assert(r==RTEMS_SUCCESSFUL);
    r=rtems_task_wake_after(100);
    assert(r==RTEMS_SUCCESSFUL);
    
    r=rtems_task_suspend(RTEMS_SELF);
    assert(r==RTEMS_SUCCESSFUL);
  }
  rtems_task_suspend(RTEMS_SELF);
}
------- end ------------






-- 
Irisa - Solidor - HADES     | E-mail : Pascal.Chevochot at irisa.fr
Bureau E-302 (niv rouge)    | Phone  : [+33|0]2 99 84 25 02
Campus de Beaulieu          | Fax    : [+33|0]2 99 84 71 71
35042 Rennes Cedex, France  | http://www.irisa.fr/solidor/work/hades



More information about the users mailing list