<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>CodeWarrior for MCUのトピックRe: Internal Error with arrays on XGATE</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Internal-Error-with-arrays-on-XGATE/m-p/210634#M8288</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error didnt go away, but i changed the code like you suggested with a pointer to the structure. So my code works fine and it´s even a bit faster &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks alot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Jul 2010 17:25:53 GMT</pubDate>
    <dc:creator>Olitsch</dc:creator>
    <dc:date>2010-07-05T17:25:53Z</dc:date>
    <item>
      <title>Internal Error with arrays on XGATE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Internal-Error-with-arrays-on-XGATE/m-p/210632#M8286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a ringbuffer in shared data segment so both cpu and XGATE can access it :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
typedef struct
{&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; unsigned char in;
&amp;nbsp; unsigned char out;
&amp;nbsp; unsigned int buffered;
&amp;nbsp; unsigned int timerOvrFl;
&amp;nbsp; unsigned char data[256];
 
} rBuffer;

rBuffer ring_buffer;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;In the cpu code the instruction&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ring_buffer.data[ring_buffer.in];&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;works fine, but when i try the same on XGATE i get a error popup:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Internal Error #601in c:\......\ccpp.cpp while compiling xgate.cxgate, please report to freescale.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a workaround is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;in=ring_buffer.in;

ring_buffer.data[in];


&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but since timing is critical i cant afford the extra operation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I´m using version 4.5 and a 9S12XDP512&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know a solution?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jul 2010 21:44:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Internal-Error-with-arrays-on-XGATE/m-p/210632#M8286</guid>
      <dc:creator>Olitsch</dc:creator>
      <dc:date>2010-07-02T21:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Error with arrays on XGATE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Internal-Error-with-arrays-on-XGATE/m-p/210633#M8287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;XGATE compiler from CW for S12(X) V5 with 5.01 patch seems being fine with this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;char cc;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;ring_buffer.data[ring_buffer.in] = cc;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;cc = &amp;nbsp;ring_buffer.data[ring_buffer.in];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If upgrading is&amp;nbsp;not an option for now, then try playing with&amp;nbsp;compiler settings.&amp;nbsp;Disabling all or some optimizations may help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You say&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;but since timing is critical i cant afford the extra operation.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At least latest XGATE compiler is able to keep local variables in registers and eliminate some intermediate operations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are worrying about timing, then you should reference your data (data structure) via pointer that could be passed as a XGATE thread argument, which is passed in R1 register. I mean doing it the same like it is done in CW wizard generated project, see how MyData struct is passed to SoftwareTrigger0_Handler().&amp;nbsp; In your case if would like as this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;data structure is passed in R1 register to XGATE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;interrupt void thr(rBuffer * __restrict rb) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cc = rb-&amp;gt;data[rb-&amp;gt;in];&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) R1 register is initialized in XGATE vector table like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; {ErrorHandler, 0x36},&amp;nbsp; // Channel 36 - XGATE Software Trigger 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; {ErrorHandler, 0x37},&amp;nbsp; // Channel 37 - XGATE Software Trigger 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.....&lt;BR /&gt;&amp;nbsp; {(XGATE_Function)thr, (int)&amp;amp;ring_buffer},&amp;nbsp;&amp;nbsp; // &amp;lt;----- pointer to ring_buffer will be loaded to R1 before thr thread call&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Jul 2010 00:13:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Internal-Error-with-arrays-on-XGATE/m-p/210633#M8287</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-07-03T00:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Error with arrays on XGATE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Internal-Error-with-arrays-on-XGATE/m-p/210634#M8288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error didnt go away, but i changed the code like you suggested with a pointer to the structure. So my code works fine and it´s even a bit faster &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks alot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jul 2010 17:25:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Internal-Error-with-arrays-on-XGATE/m-p/210634#M8288</guid>
      <dc:creator>Olitsch</dc:creator>
      <dc:date>2010-07-05T17:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Error with arrays on XGATE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Internal-Error-with-arrays-on-XGATE/m-p/210635#M8289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try the 5.0? If this bug may still be in the latest version, it would be helpful if you file a service request so&lt;/P&gt;&lt;P&gt;FSL can make sure it gets fixed. Otherwise sooner or later others way stumble across it, for sure.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Daniel&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jul 2010 04:38:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Internal-Error-with-arrays-on-XGATE/m-p/210635#M8289</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2010-07-06T04:38:20Z</dc:date>
    </item>
  </channel>
</rss>

