<?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: __far increments only low order 16 bits in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/far-increments-only-low-order-16-bits/m-p/154134#M3858</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;kef wrote:&lt;BR /&gt;&lt;P&gt;It is normal.&amp;nbsp;Try replacing __far with __ptr24. __far pointer math is faster, but G-page part of it isn't updated. This is OK for project wizard default PRM files, where no segment is crossing G-page boundary.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Ah. That explains why I inherited broken code. It wasn't actually broken.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Initially, our PRM file created descrete segments. However, due to a bug in our customer's Service Programming Tool, we have to deliver a contiguous&amp;nbsp;HEX file. Since both the SPT and&amp;nbsp;the tool that generates that data file from that HEX file, checks/inserts a checksum based on the entire contents, we coded our ROM check to do likewise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, when we added the FILL 0xFF to our segment definitions to create one contiguous load image, the segment table sent to our boot loader only had a single entry - for the entire load image. Since we coded our ROM check to use that table, that "broke" the __far pointer.&lt;/P&gt;&lt;P&gt;﻿﻿&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Jul 2011 00:42:51 GMT</pubDate>
    <dc:creator>rlw</dc:creator>
    <dc:date>2011-07-28T00:42:51Z</dc:date>
    <item>
      <title>__far increments only low order 16 bits</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/far-increments-only-low-order-16-bits/m-p/154132#M3856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using CW 5.0 for S12X with a S12XE384&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Far pointer variable defined as:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN style="color: #800080;"&gt;static unsigned int&lt;/SPAN&gt;&lt;SPAN&gt;*&lt;/SPAN&gt; &lt;SPAN&gt;__far&lt;/SPAN&gt; &lt;SPAN&gt;adr&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;In this loop:&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN style="color: #800080;"&gt;while&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;adr&lt;/SPAN&gt; &lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN&gt;segEnd&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cs&lt;/SPAN&gt; &lt;SPAN&gt;+=&lt;/SPAN&gt; &lt;SPAN&gt;*&lt;/SPAN&gt;&lt;SPAN&gt;adr&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;adr&lt;/SPAN&gt;&lt;SPAN&gt;++;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;The generated code is:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;0072 fe0000&amp;nbsp;&amp;nbsp; LDX&amp;nbsp;&amp;nbsp; adr:1&amp;nbsp; 0075 f60000&amp;nbsp;&amp;nbsp; LDAB&amp;nbsp; adr&amp;nbsp; 0078 5b10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STAB&amp;nbsp; 16&amp;nbsp; 007a 18ec31&amp;nbsp;&amp;nbsp; GLDD&amp;nbsp; 2,X+&amp;nbsp; 007d f30000&amp;nbsp;&amp;nbsp; ADDD&amp;nbsp; cs&amp;nbsp; 0080 7c0000&amp;nbsp;&amp;nbsp; STD&amp;nbsp;&amp;nbsp; cs&amp;nbsp; 0083 7e0000&amp;nbsp;&amp;nbsp; STX&amp;nbsp;&amp;nbsp; adr:1&amp;nbsp; 008d 0705&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BSR&amp;nbsp;&amp;nbsp; *+7 ;abs = 0094&amp;nbsp; 008f 22e1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BHI&amp;nbsp;&amp;nbsp; *-29 ;abs = 0072&amp;nbsp; // other code&amp;nbsp; 0094 fe0000&amp;nbsp;&amp;nbsp; LDX&amp;nbsp;&amp;nbsp; adr:1&amp;nbsp; 0097 f60000&amp;nbsp;&amp;nbsp; LDAB&amp;nbsp; adr&amp;nbsp; 009a fd0000&amp;nbsp;&amp;nbsp; LDY&amp;nbsp;&amp;nbsp; segEnd:1&amp;nbsp; 009d b60000&amp;nbsp;&amp;nbsp; LDAA&amp;nbsp; segEnd&amp;nbsp; 00a0 060000&amp;nbsp;&amp;nbsp; JMP&amp;nbsp;&amp;nbsp; _FPCMP&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;The generated code is not incrementing the high order byte of the far address.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this a compiler bug?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a work-around, when I change the type of adr to be unsigned long (and add the apropriate type casts), the generated code does increment the high order portion of the address.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:57:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/far-increments-only-low-order-16-bits/m-p/154132#M3856</guid>
      <dc:creator>rlw</dc:creator>
      <dc:date>2020-10-29T08:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: __far increments only low order 16 bits</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/far-increments-only-low-order-16-bits/m-p/154133#M3857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is normal.&amp;nbsp;Try replacing __far with __ptr24. __far pointer math is faster, but G-page part of it isn't updated. This is OK for project wizard default PRM files, where no segment is crossing G-page boundary.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 00:02:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/far-increments-only-low-order-16-bits/m-p/154133#M3857</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2011-07-28T00:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: __far increments only low order 16 bits</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/far-increments-only-low-order-16-bits/m-p/154134#M3858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;kef wrote:&lt;BR /&gt;&lt;P&gt;It is normal.&amp;nbsp;Try replacing __far with __ptr24. __far pointer math is faster, but G-page part of it isn't updated. This is OK for project wizard default PRM files, where no segment is crossing G-page boundary.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Ah. That explains why I inherited broken code. It wasn't actually broken.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Initially, our PRM file created descrete segments. However, due to a bug in our customer's Service Programming Tool, we have to deliver a contiguous&amp;nbsp;HEX file. Since both the SPT and&amp;nbsp;the tool that generates that data file from that HEX file, checks/inserts a checksum based on the entire contents, we coded our ROM check to do likewise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, when we added the FILL 0xFF to our segment definitions to create one contiguous load image, the segment table sent to our boot loader only had a single entry - for the entire load image. Since we coded our ROM check to use that table, that "broke" the __far pointer.&lt;/P&gt;&lt;P&gt;﻿﻿&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2011 00:42:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/far-increments-only-low-order-16-bits/m-p/154134#M3858</guid>
      <dc:creator>rlw</dc:creator>
      <dc:date>2011-07-28T00:42:51Z</dc:date>
    </item>
  </channel>
</rss>

