<?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>Classic/Legacy CodeWarrior中的主题 Re: incorrect value is read for const variable in banked memory area</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437225#M6928</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I myself suggest you use __PPAGE_SEG instead of __FAR_SEG . we rarely use it .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__FAR_SEG&amp;nbsp; is the alias of FAR, while __PPAGE_SEG is the alias of PPAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are two methods to access paged memory. accessing via PPAGE(paged address) or GPAGE(global address).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attached two demo code for each of them. can this help you?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;/P&gt;&lt;P&gt;Zhang Jun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Jun 2015 09:04:35 GMT</pubDate>
    <dc:creator>ZhangJennie</dc:creator>
    <dc:date>2015-06-30T09:04:35Z</dc:date>
    <item>
      <title>incorrect value is read for const variable in banked memory area</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437222#M6925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Hello All,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;in my linker file i have defined as below&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;PAGEF8 0xF88000 to 0xF8BFFF&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;APP_CONST_DATA&amp;nbsp; INTO PAGEF8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;while i have define a variable in &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;partnumber.c as below&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;#pragma CONST_SEG __PPAGE_SEG APP_CONST_DATA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;volatile const partnumber[3]={1,2,3};&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;#pragma CONST_SEG DEFAULT&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;and in partnumber.h &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;#pragma CONST_SEG __PPAGE_SEG APP_CONST_DATA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;extern volatile const partnumber[3];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;#pragma CONST_SEG DEFAULT&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;and i trying to read this variable in appfile.c as below, but it is always reading garbage value instead of above mention values. I gave included partnumber.h in appfile.c&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;appdata[0] = partnumber[0];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;appdata[1] = partnumber[1];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;appdata[2] = partnumber[2];&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;what could be the reason , what am i doing wrong ? I am using HCS12X family controller.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Kind regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Ketan&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 02:34:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437222#M6925</guid>
      <dc:creator>ketanshah</dc:creator>
      <dc:date>2015-06-27T02:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: incorrect value is read for const variable in banked memory area</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437223#M6926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On S12X you should use GPAGE to access data from P-paged memory. Just replace __PPAGE_SEG to __GPAGE_SEG in your code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 05:45:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437223#M6926</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2015-06-30T05:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: incorrect value is read for const variable in banked memory area</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437224#M6927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply, this works.&lt;/P&gt;&lt;P&gt;But I also tried as below and that also works, could you please tell which one is better ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;partnumber.c&amp;nbsp; as below&lt;/P&gt;&lt;P&gt;#pragma CONST_SEG __FAR_SEG APP_CONST_DATA&lt;/P&gt;&lt;P&gt;volatile const UNUM8&amp;nbsp; __far partnumber = {1,2,3};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma CONST_SEG DEFAULT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;partnumber.h as below&lt;/P&gt;&lt;P&gt;#pragma CONST_SEG __FAR_SEG APP_CONST_DATA&lt;/P&gt;&lt;P&gt;volatile const UNUM8 __far partnumber[3];&lt;/P&gt;&lt;P&gt;#pragma CONST_SEG DEFAULT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 08:19:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437224#M6927</guid>
      <dc:creator>ketanshah</dc:creator>
      <dc:date>2015-06-30T08:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: incorrect value is read for const variable in banked memory area</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437225#M6928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I myself suggest you use __PPAGE_SEG instead of __FAR_SEG . we rarely use it .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__FAR_SEG&amp;nbsp; is the alias of FAR, while __PPAGE_SEG is the alias of PPAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are two methods to access paged memory. accessing via PPAGE(paged address) or GPAGE(global address).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attached two demo code for each of them. can this help you?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;/P&gt;&lt;P&gt;Zhang Jun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 09:04:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437225#M6928</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2015-06-30T09:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: incorrect value is read for const variable in banked memory area</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437226#M6929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI&gt;I myself suggest you use &lt;STRONG&gt;__PPAGE_SEG&lt;/STRONG&gt; instead of __FAR_SEG . we rarely use it .&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Zhang, certainly it is a typo and you meant __GPAGE_SEG here. __PPAGE_SEG is not useful for paged data on S12X, unless small memory model is used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since __FAR_SEG applied to data is alias for __GPAGE_SEG on S12X, and alias for __PPAGE_SEG on older HC12 and S12 (which lack GPAGE and Gxxx CPU instructions), it makes some sense to use __FAR_SEG, if you want better code compatibility and want to use same code on both HC12/S12 and S12X.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;there are two methods to access paged memory. accessing via PPAGE(paged address) or GPAGE(global address).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Right. But unless small memory model is used, accessing paged data via PPAGE is very slow.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2015 05:56:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437226#M6929</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2015-07-01T05:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: incorrect value is read for const variable in banked memory area</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437227#M6930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;hello, there is some misunderstanding (maybe i didn't say it clear ). i don't suggest use __FAR_SEG is not because it uses GPAGE. but because it is rarely used in HCS12x family.&amp;nbsp; at least among my customer, because HCS12X has keyword __GPAGE_SEG which is specially designed for HCS12X family for global access. Using __GPAGE_SEG is more clear and readable for programmer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;__FAR_SEG is used in HCS12, HCS12X, HC12 and even HCS08 and RS08.&amp;nbsp;&amp;nbsp; If user considers porting code for these different platforms, yes, &lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;__FAR_SEG wins.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;&lt;BR /&gt; Have a great day,&lt;BR /&gt; Zhang Jun&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt; Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt; -----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2015 06:56:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/incorrect-value-is-read-for-const-variable-in-banked-memory-area/m-p/437227#M6930</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2015-07-01T06:56:26Z</dc:date>
    </item>
  </channel>
</rss>

