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