<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Reentrant function problems with memcpy()</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/18097/reentrant-function-problems-with-memcpy</link><description> I have a reentrant function that is passed a single parameter as follows: 
 
 
void Filt_QR ( FilterDataType * FilterData ) reentrant
{
 unsigned char aucTemp40[5];
 memcpy( aucTemp40, /* void * dest */
 FilterData-&amp;gt;aucYpterm_40, /* void * src */
 5</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Reentrant function problems with memcpy()</title><link>https://community.arm.com/thread/43009?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2004 20:29:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b288936d-c4ae-4957-8a73-3a4627aabee6</guid><dc:creator>Drew Davis</dc:creator><description>&lt;p&gt;Can you post the assembler code generated for this function from the .lst file?&lt;br /&gt;
&lt;br /&gt;
By &amp;quot;always gets the destination wrong&amp;quot;, you mean &amp;quot;not anywhere in the reentrant stack&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
What happens if you do this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
void Filt_QR ( FilterDataType * FilterData )  reentrant
{
    unsigned long aucTemp40_4;
    unsigned char aucTemp40_1;
    memcpy( &amp;amp;aucTemp40_4,                /*   void * dest   */
            FilterData-&amp;gt;aucYpterm_40, /*   void * src    */
            5);                       /*   int    len    */


&lt;/pre&gt;
&lt;br /&gt;
Cheesy, but I&amp;#39;m curious if the array on the stack confuses the compiler.&lt;br /&gt;
&lt;br /&gt;
8051 variants with dual data pointers are a bit better at handling memcpy().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reentrant function problems with memcpy()</title><link>https://community.arm.com/thread/86984?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2004 11:55:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4ad2d158-201f-4420-ba96-e4e424c66807</guid><dc:creator>Keil Software Support Intl.</dc:creator><description>&lt;p&gt;Please send your test code to support.intl@keil.com&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reentrant function problems with memcpy()</title><link>https://community.arm.com/thread/86974?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2004 10:09:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ca8d1f03-7861-432a-b401-780ff05e7d77</guid><dc:creator>Kenny  ODell</dc:creator><description>&lt;p&gt;By the way, I&amp;#39;m using uVision2 V2.38a, C Compiler V7.06.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reentrant function problems with memcpy()</title><link>https://community.arm.com/thread/86973?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2004 10:07:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7b400b49-b623-4cf1-8845-447bc955619b</guid><dc:creator>Kenny  ODell</dc:creator><description>&lt;p&gt;Yes, the stack pointer is set up correctly.&lt;br /&gt;
&lt;br /&gt;
As to selection of the 8051, this is what I am stuck with.  It is a Mentor Graphics E-Warp core in a custom ASIC (on-chip 24-bit A/D).  Just can&amp;#39;t figure out why it doesn&amp;#39;t like to apply the correct address to local variables...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reentrant function problems with memcpy()</title><link>https://community.arm.com/thread/43001?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2004 09:33:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:aa62769d-3872-4c55-b032-6e9139b0a69b</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;Reentrant function and memcpy()&lt;br /&gt;
&lt;br /&gt;
Are you sure the &amp;#39;51 is the right chip for you?&lt;br /&gt;
&lt;br /&gt;
You are using two things that the &amp;#39;51 is singularily lousy at.&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reentrant function problems with memcpy()</title><link>https://community.arm.com/thread/43000?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2004 09:32:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:04b74dcf-cf9b-4303-9554-a254fa94d5d1</guid><dc:creator>Keil Software Support Intl.</dc:creator><description>&lt;p&gt;Did you initialize the reentrant stack pointer in the STARTUP.A51 file?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>