Very strange bug
Joel Sherrill
joel at OARcorp.com
Fri Jun 15 22:07:07 UTC 2001
Pascal Chevochot wrote:
> 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 ?
I ran it on the sparc/erc32 BSP and it worked fine. It produced this
output:
1
id
2
wakeup
And then went into a tight look in mainThread. What else does it do?
I would normally suspect a stack problem. I would suspect that printf
takes more
memory than puts. But that is just a guess.
>
> 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 ------------
>
>
>
>
>
>
More information about the users
mailing list