<?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>topic Re: Convert __pptr pointer to far pointer in compile time in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Convert-pptr-pointer-to-far-pointer-in-compile-time/m-p/153997#M3835</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Oh, thanks, makes total sense.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;On a related note:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm trying to increment far pointers to do said checksums&amp;nbsp;and notice that it only increments the lower word, not the GPAGE portion.&amp;nbsp; My quick fix is to cast to unsigned long and back, but longer term I plan to write something in assembler to do&amp;nbsp;it without that unhappiness.&amp;nbsp; Any idea if this is expected/documented behavior?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Dave&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 May 2008 22:49:48 GMT</pubDate>
    <dc:creator>Deedah</dc:creator>
    <dc:date>2008-05-08T22:49:48Z</dc:date>
    <item>
      <title>Convert __pptr pointer to far pointer in compile time</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Convert-pptr-pointer-to-far-pointer-in-compile-time/m-p/153995#M3833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using S12XDP512:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am creating a table of FLASH ranges across which to calculate CRC.&amp;nbsp; I'd like to enter in the logical paged addresses (__pptr pointer) into the C file (see below) instead of the global address (far pointer)- primarily because it takes an extra step to convert from what's seen in the PRM linker file to the global address.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The issue I had with this is that casting a __pptr to far pointer seemed to only work at run time....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, my attempt at, say,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void * far farptr = (void * far) ( (void * __pptr)0xFEFFFF; )&amp;nbsp; //extra parenthesis to be explicit&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;would result in farptr being initialized with 0xFEFFFF.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My intermediate solution was to store all the pointer values as __pptr and then at startup I run a cast of all of them:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void * __pptr pageptr = (void * __pptr)0xFEFFFF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;void * far farptr;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;int main() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; farptr = (void * far)pageptr;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;But I don't want to use up memory for this extra table unnecessarily.&amp;nbsp; I'd like the values to be const somewhere and not worry about doing this at runtime.&amp;nbsp; Can anyone comment on how I can convert these pointers at compile time?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dave&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2008 22:55:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Convert-pptr-pointer-to-far-pointer-in-compile-time/m-p/153995#M3833</guid>
      <dc:creator>Deedah</dc:creator>
      <dc:date>2008-05-07T22:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Convert __pptr pointer to far pointer in compile time</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Convert-pptr-pointer-to-far-pointer-in-compile-time/m-p/153996#M3834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;What about address conversion macro?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#define PPTR2FAR(x) ((void * far)(0x400000 | ((x &amp;gt;&amp;gt; 16) * 0x4000) | (x &amp;amp; 0x3FFF)))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;No problem using it at compile time.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void * const far farptr = PPTR2FAR(0xFEBFFF);&amp;nbsp;&amp;nbsp; //extra parenthesis to be explicit&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;BTW, 0xFEFFFF is illegal PPAGE logical address, offset is out of PPAGE window 0x8000..0xBFFF.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2008 03:03:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Convert-pptr-pointer-to-far-pointer-in-compile-time/m-p/153996#M3834</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2008-05-08T03:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert __pptr pointer to far pointer in compile time</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Convert-pptr-pointer-to-far-pointer-in-compile-time/m-p/153997#M3835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Oh, thanks, makes total sense.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;On a related note:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm trying to increment far pointers to do said checksums&amp;nbsp;and notice that it only increments the lower word, not the GPAGE portion.&amp;nbsp; My quick fix is to cast to unsigned long and back, but longer term I plan to write something in assembler to do&amp;nbsp;it without that unhappiness.&amp;nbsp; Any idea if this is expected/documented behavior?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Dave&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2008 22:49:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Convert-pptr-pointer-to-far-pointer-in-compile-time/m-p/153997#M3835</guid>
      <dc:creator>Deedah</dc:creator>
      <dc:date>2008-05-08T22:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Convert __pptr pointer to far pointer in compile time</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Convert-pptr-pointer-to-far-pointer-in-compile-time/m-p/153998#M3836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is an expected behavior.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The S12X instruction set performs all address calculations on 16 bit only, it does not propagate overflows into the page.&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2008 13:37:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Convert-pptr-pointer-to-far-pointer-in-compile-time/m-p/153998#M3836</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2008-05-09T13:37:22Z</dc:date>
    </item>
  </channel>
</rss>

