I'm not sure what could have cause the pattern. I would say a memory overwrite as already suggested but i'm still not aware of its source. <br><br>Update:<br>No problems with -O2.<br>I also included the RTEMS_FLOATING_POINT as 
instructed by Jiri and everything goes well.<br><br><br>Best,<br>JM<br><br><div class="gmail_quote">On Thu, Jun 17, 2010 at 4:11 PM, Andrei Chichak <span dir="ltr"><<a href="mailto:groups@chichak.ca">groups@chichak.ca</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;"><div style="word-wrap: break-word;">Just an observation:<div><br></div><div>The pattern that is being printed has the hex values AA 99 55 66. First, it's pretty odd that all of the nybbles are the same in each byte. Next, the first and third bytes are complements of each other as are the second and fourth.</div>
<div><br></div><div>This looks like a test pattern.</div><div><br></div><font color="#888888"><div>Andrei</div></font><div><div></div><div class="h5"><div><br></div><div><br><div><div><div>On 2010-June-16, at 11:48 AM, João Rasta wrote:</div>
<br><blockquote type="cite">Yes, here goes<br><br>// dummy printf test code<br>int upa(void)<br>{<br>    int i = 0;<br><br>    for (i=0; i < 20; i++)<br>        printf("B\n");<br><br>    exit(0);<br><br>}<br>
<br>And the result is:<br><br>

<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>    ¬ÖUf<br>

    ¬ÖUf<br>
    ¬ÖUf<br><br>Program exited normally. This same code works correctly if i put the function in the main code instead of the library code. I still have no idea of what can be causing this, any hints would be apreciated. Mabe a compiler flag is messing up the library code? <br>


<br>The matlab autocode makefile generates some flags i don't recognize such as the DXXX:<br><br>sparc-rtems-gcc -c -O3 -g3 -ffloat-store -fPIC   -DUSE_RTMODEL -DMODEL=gnc -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DUNIX -DMT=0 -DHAVESTDI<br>

O   -I. -I../../rtwlt/matlab/simulink/include -I../../rtwlt/matlab/extern/include -I../../rtwlt/matlab/rtw/c/src -I../../rtwlt/matlab/rtw/c/<br>src/ext_mode/common -I. -I.. -I../../rtwlt/matlab/rtw/c/libsrc   ../../rtwlt/matlab/rtw/c/src/rt_sim.c<br>

<br><br>These flags are not used in the "main" code, for instance<br><br>sparc-rtems-gcc  -DLOGGING=1 -DLOGNOTORIETY=10 -I"../src" -I"../src/comms/packet_lib" -I"../src/shell" -I"../src/comms" -I"../model/gnc_linu<br>

x" -I../rtwlt/matlab/simulink/include -I../rtwlt/matlab/extern/include -I../rtwlt/matlab/rtw/c/src -I../rtwlt/matlab/rtw/c/src/ext_mode/comm<br>on -I../rtwlt/matlab/rtw/c/libsrc   -O2 -g -Wall -c -fmessage-length=0 -DRT -MMD -MP -MF"src/common.d" -MT"src/common.d" -o"src/common.o" ".<br>

./src/common.c"<br><br>Has anyone seen the DXX flags?<br><br>Best,<br>JM<br><br><br><div class="gmail_quote">On Wed, Jun 16, 2010 at 6:31 PM, Till Straumann <span dir="ltr"><<a href="mailto:strauman@slac.stanford.edu" target="_blank">strauman@slac.stanford.edu</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;">


  

<div bgcolor="#ffffff" text="#000000">
Can you post the offending code?<br>
<br>
T.<div><div></div><div><br>
<br>
On 06/16/2010 12:02 PM, João Rasta wrote:
</div></div><blockquote type="cite"><div><div></div><div>Just an update:<br>
  <br>
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..<br>
  <br>
  <br>
Best,<br>
JM<br>
  <br>
  <div class="gmail_quote">On Wed, Jun 16, 2010 at 4:56 PM, Joel
Sherrill <span dir="ltr"><<a href="mailto:joel.sherrill@oarcorp.com" target="_blank">joel.sherrill@oarcorp.com</a>></span>
wrote:<br>
  <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div>On 06/16/2010 10:52 AM, João Rasta wrote:<br>
    </div>
    <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
      <br>
      <div>No, autocode requires the real-time workbench
only, it is quite straightforward to generate the code.<br>
      <br>
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..<br>
      </div>
    </blockquote>
Is it including stdio.h?  I have seen some targets where if you don't
the variable<br>
arguments stuff gets confused.<br>
    <br>
Is the generated code warning free?
    <div><br>
    <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
      <br>
I suspect of a compilation flag/option i may be missing on the library.
Do you have any idea?<br>
      <br>
    </blockquote>
    </div>
As long as it is compiled the same as the rest of the app, it should be
ok.
    <div><br>
    <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.<br>
      <br>
    </blockquote>
    </div>
Right.<br>
    <br>
Can you print from other tasks?<br>
    <br>
--joel<br>
    <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
      <br>
Best,<br>
JM
      <div>
      <div><br>
      <br>
      <br>
      <br>
On Wed, Jun 16, 2010 at 4:42 PM, Joel Sherrill <<a href="mailto:joel.sherrill@oarcorp.com" target="_blank">joel.sherrill@oarcorp.com</a> <mailto:<a href="mailto:joel.sherrill@oarcorp.com" target="_blank">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 that uses code<br>
       generated from matlab using autocode. It all goes well until a<br>
       function of this library is called: printfs return awkward<br>
       characters and then the application crashes.<br>
      <br>
   I have seen references to this before.  Is this hard to do?  Are<br>
   there instructions?<br>
   Standard glue code, etc.<br>
      <br>
       1) Is there any obvious reason to why printfs of the autocode<br>
       generated functions are not working properly? They are<br>
       compiled with sparc-rtems-gcc, as the main code.<br>
      <br>
       2) Are there any special flags needed to be passed to the<br>
       compiler in order to link other libraries? Or some rtems<br>
       configuration..<br>
      <br>
   Is there any chance it is printing floating point numbers from a<br>
   non-FP task?<br>
      <br>
      <br>
       Best,<br>
       JM<br>
      <br>
      <br>
      <br>
   --     Joel Sherrill, Ph.D.             Director of Research&
 Development<br>
   <a href="mailto:joel.sherrill@OARcorp.com" target="_blank">joel.sherrill@OARcorp.com</a>        On-Line Applications Research<br>
   Ask me about RTEMS: a free RTOS  Huntsville AL 35805<br>
     Support Available             (256) 722-9985<br>
      <br>
      <br>
      <br>
      </div>
      </div>
    </blockquote>
    <div>
    <div><br>
    <br>
-- <br>
Joel Sherrill, Ph.D.             Director of Research&  Development<br>
<a href="mailto:joel.sherrill@OARcorp.com" target="_blank">joel.sherrill@OARcorp.com</a>        On-Line Applications Research<br>
Ask me about RTEMS: a free RTOS  Huntsville AL 35805<br>
  Support Available             (256) 722-9985<br>
    <br>
    <br>
    </div>
    </div>
  </blockquote>
  </div>
  <br>
  </div></div><pre><fieldset></fieldset>
_______________________________________________
rtems-users mailing list
<div><a href="mailto:rtems-users@rtems.org" target="_blank">rtems-users@rtems.org</a>
<a href="http://www.rtems.org/mailman/listinfo/rtems-users" target="_blank">http://www.rtems.org/mailman/listinfo/rtems-users</a>
  </div></pre>
</blockquote>
<br>
</div>

</blockquote></div><br>
_______________________________________________<br>rtems-users mailing list<br><a href="mailto:rtems-users@rtems.org" target="_blank">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>
</blockquote></div><br>
<br></div></div></div></div></div><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>
<br></blockquote></div><br>