rtems with matlab autocode problems
Jiri Gaisler
jiri at gaisler.com
Wed Jun 16 18:15:00 UTC 2010
Everything in RTEMS is a task, either the init task or created 'secondary'
tasks. You might want to set CONFIGURE_INIT_TASK_STACK_SIZE to some higher
value if your auto-code uses a lot of stack space ...
But the proper way to debug this is to put a breakpoint on the offending
printf, and check what the string parameter points to. If it is not your
intended string ("B\n"), it might have been overwritten in memory. Put a
watch point on the address and check when it is written. Alternatively,
the pointer to the string might have been overwritten, which can be
tracked by similar means ...
Jiri.
João Rasta wrote:
> It is not a task, just a simple function call. I passed this call to the
> first thing in the void POSIX_Init() and the same happens. No matter
> what i pass to printf or puts it allways writes the same if this
> function is implemented on the autocode *.c files..
>
>
> Best,
> JM
>
> On Wed, Jun 16, 2010 at 6:31 PM, Jiri Gaisler <jiri at gaisler.com
> <mailto:jiri at gaisler.com>> wrote:
>
>
> Each task is allocated a certain amount of stack space - how much
> have you allocated to your auto-code one? You might try the RTEMS
> stack checker to detect a stack overflow ...
>
> Jiri.
>
> João Rasta wrote:
> > How can i be sure?
> >
> > The fact is that if i read the contents of all the memory space with
> > grmon, they are not zero.. And i have "washed" prior to load the
> > application.
> >
> >
> > Best,
> > JM
> >
> > On Wed, Jun 16, 2010 at 6:11 PM, Jiri Gaisler <jiri at gaisler.com
> <mailto:jiri at gaisler.com>
> > <mailto:jiri at gaisler.com <mailto:jiri at gaisler.com>>> wrote:
> >
> >
> >
> > João Rasta wrote:
> > > Just an update:
> > >
> > > If i do fflush(stdout) inside the test function, the application
> > > crashes. Also, no matter what i put in printf, it allways
> prints the
> > > same characters, but it detects the \n correctly.. I don't
> see if this
> > > can be related to the compiler..
> >
> > Sounds to me like you have blown the stack or run out of
> memory ...
> >
> > Jiri.
> >
> > >
> > >
> > > Best,
> > > JM
> > >
> > > On Wed, Jun 16, 2010 at 4:56 PM, Joel Sherrill
> > > <joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com> <mailto:joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>>
> > <mailto:joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>
> > <mailto:joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>>>> wrote:
> > >
> > > On 06/16/2010 10:52 AM, João Rasta wrote:
> > >
> > > Hi,
> > >
> > > No, autocode requires the real-time workbench only,
> it is
> > quite
> > > straightforward to generate the code.
> > >
> > > I didn't fully understood your question. Anyway, i have
> > tried to
> > > compile the application with gcc and runs fine on
> linux so it
> > > should run on rtems with the apropriate modifications.
> > However,
> > > when i printf("test\n") within the library finction, it
> > returns
> > > strange characters, which doesn't happen in the
> function that
> > > calls the library function..
> > >
> > > Is it including stdio.h? I have seen some targets where
> if you
> > > don't the variable
> > > arguments stuff gets confused.
> > >
> > > Is the generated code warning free?
> > >
> > >
> > > I suspect of a compilation flag/option i may be
> missing on the
> > > library. Do you have any idea?
> > >
> > > As long as it is compiled the same as the rest of the
> app, it
> > should
> > > be ok.
> > >
> > > Also, i don't need any rtems
> primitives/configurations on the
> > > library functions right? I'm assuimng It is enough
> to have the
> > > rtems configuration on the "main" file.
> > >
> > > Right.
> > >
> > > Can you print from other tasks?
> > >
> > > --joel
> > >
> > >
> > > Best,
> > > JM
> > >
> > >
> > >
> > >
> > > On Wed, Jun 16, 2010 at 4:42 PM, Joel Sherrill
> > > <joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>
> > <mailto:joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>>
> <mailto:joel.sherrill at oarcorp.com <mailto:joel.sherrill at oarcorp.com>
> > <mailto:joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>>>
> > > <mailto:joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>
> > <mailto:joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>>
> > > <mailto:joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>
> > <mailto:joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>>>>> wrote:
> > >
> > > On 06/16/2010 10:38 AM, João Rasta wrote:
> > >
> > > Hi,
> > >
> > > I'm having trouble running an rtems application
> > that uses
> > > code
> > > generated from matlab using autocode. It all
> goes well
> > > until a
> > > function of this library is called: printfs
> return
> > awkward
> > > characters and then the application crashes.
> > >
> > > I have seen references to this before. Is this
> hard to
> > do? Are
> > > there instructions?
> > > Standard glue code, etc.
> > >
> > > 1) Is there any obvious reason to why printfs of
> > the autocode
> > > generated functions are not working properly?
> They are
> > > compiled with sparc-rtems-gcc, as the main code.
> > >
> > > 2) Are there any special flags needed to be
> passed
> > to the
> > > compiler in order to link other libraries? Or
> some
> > rtems
> > > configuration..
> > >
> > > Is there any chance it is printing floating point
> > numbers from a
> > > non-FP task?
> > >
> > >
> > > Best,
> > > JM
> > >
> > >
> > >
> > > -- Joel Sherrill, Ph.D. Director of
> > Research&
> > > Development
> > > joel.sherrill at OARcorp.com On-Line Applications
> > Research
> > > Ask me about RTEMS: a free RTOS Huntsville AL 35805
> > > Support Available (256) 722-9985
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Joel Sherrill, Ph.D. Director of Research&
> > Development
> > > joel.sherrill at OARcorp.com On-Line Applications
> Research
> > > Ask me about RTEMS: a free RTOS Huntsville AL 35805
> > > Support Available (256) 722-9985
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > rtems-users mailing list
> > > rtems-users at rtems.org <mailto:rtems-users at rtems.org>
> <mailto:rtems-users at rtems.org <mailto:rtems-users at rtems.org>>
> > > http://www.rtems.org/mailman/listinfo/rtems-users
> >
> >
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org <mailto:rtems-users at rtems.org>
> http://www.rtems.org/mailman/listinfo/rtems-users
>
>
More information about the users
mailing list