<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 30, 2013 at 3:41 AM, Sebastian Huber <span dir="ltr"><<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On 04/29/2013 10:57 PM, Daron Chabot wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hi,<br>
<br>
I'm working with RTEMS 4.9.3 and the mvme3100 BSP<br>
<br>
In trying to emulate the vxworks function, memalign( ), and it looks like:<br>
<br>
1) there is no equivalent in RTEMS, but it's prototyped in newlib<br>
2) posix_memalign( ) is defined in cpukit/libcsupport/src, but does not appear<br>
in any headers and cannot be linked against. It's definitely in librtemscpu.a:<br>
<br>
------------------------------<u></u>---------<br>
dchabot@dev32new--> nm /usr/powerpc-rtems4.9/<u></u>mvme3100/lib/librtemscpu.a<br>
libcsupport_a-posix_memalign.<u></u>o:<br>
00000000 T posix_memalign<br>
U rtems_malloc_statistics<br>
U rtems_memalign<br>
------------------------------<u></u>---------<br>
</blockquote>
<br></div>
What is the linker problem with this function?</blockquote><div><br></div><div style>Sorry, my mistake. Once I added a prototype for posix_memalign, all is well with the linker.</div><div style><br></div><div style>Note, the prototype is missing from the version of newlib's "stdlib.h" that we're using with RTEMS 4.9.3.</div>
<div style>I see Ralf had posted a patch upstream back in 2009 (<a href="http://sourceware.org/ml/newlib/2009/msg00924.html">http://sourceware.org/ml/newlib/2009/msg00924.html</a>).</div><div style><br></div><div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">3) rtems_memalign( ) appears to be the only functional variant<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Is there a more elegant solution here than creating my own memalign( ) wrapper<br>
around rtems_memalign( ) ? It seems like an error to not have a posix_memalign(<br>
) available...<br>
</blockquote>
<br></div>
Since memalign() has a prototype in Newlib's <malloc.h> you can simply add an implementation to cpukit/libcsupport and a test case to testsuites/libtests/memalign01 if you want.</blockquote><div><br></div><div style>
I'd prefer to use posix_memalign, as it seems the use of memalign is being deprecated/made obsolete (from the man-page).</div><div style><br></div><div style>Thanks, Sebastian.</div><div style><br></div><div style><br>
</div><div style>-- dc</div></div></div></div>