<?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>S12 / MagniV MicrocontrollersのトピックRe: S12G128 P-Flash reading issue in bootloader</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613094#M13220</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;which version of the CW you use? (No IDE version but CW4.1, 4.2,.5.0, 5.1, 5.2)&lt;/P&gt;&lt;P&gt;Could you please send me your project? You can use standard "support" way to nxp - just introduce email by hello Ladislav. (&lt;A href="https://community.nxp.com/docs/DOC-329745"&gt;https://community.nxp.com/docs/DOC-329745&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;P&gt;However, it would be better if you are able to send shortened, fuctional, issue highlighting version of the project.&lt;/P&gt;&lt;P&gt;(Do not forget to pack entire project. I hope you have set the project paths relative to project. The best is if everything is placed in the project folder)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you can send it to &lt;A href="mailto:hcs12@seznam.cz"&gt;hcs12@seznam.cz&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I'll check and correct it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ladislav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Mar 2017 07:51:03 GMT</pubDate>
    <dc:creator>lama</dc:creator>
    <dc:date>2017-03-03T07:51:03Z</dc:date>
    <item>
      <title>S12G128 P-Flash reading issue in bootloader</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613091#M13217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on S12G128 bootloader, it is based on AN4258.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some certain chars have been written to P-Flash global address 0x2FE00, so after reset, bootloader will read address 0x2FE00 and decide how to go. A far pointer Upg_Cmd defined for this operation. See below code for more details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define Upg_Cmd_Addr 0x2FE00 //Global address 0x2FE00, store the&amp;nbsp;chars&lt;/P&gt;&lt;P&gt;UINT8 * far Upg_Cmd;&lt;/P&gt;&lt;P&gt;#define GlobalToLocal(Address) (((Address) &amp;amp; 0x3FFFU) | (((Address) &amp;amp; 0x003FC000UL) &amp;lt;&amp;lt; 2U) | 0x8000U)&lt;/P&gt;&lt;P&gt;UINT8 cc;&lt;/P&gt;&lt;P&gt;UINT8 const far upg_cmd_array[] @0x0BBE00 = "54600856"; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//For debugging, test if bootloader can read these chars.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In main program, I'm using Upg_Cmd pointer to get the content in 0x2FE00 (Local paged address 0xBBE00) but always get&amp;nbsp;0xFF. I checked in BDM debugger interface and the actual content of&amp;nbsp;&lt;SPAN&gt;0x2FE00&amp;nbsp;(Local paged address 0xBBE00) is correct and not corrupted, also,&amp;nbsp;Upg_Cmd can be correctly assigned 0xBBE00.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt; Upg_Cmd= (UINT8 * far) GlobalToLocal(Upg_Cmd_Addr);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt; cc= *Upg_Cmd++;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When code executed, cc is 0xFF which suppose to be '5'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any hints are apppreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Walter&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2017 01:20:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613091#M13217</guid>
      <dc:creator>walter_wang</dc:creator>
      <dc:date>2017-03-02T01:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: S12G128 P-Flash reading issue in bootloader</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613092#M13218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;see attached example project and read the main.c file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//------------------------------------------------------------------------------&lt;BR /&gt;// for space creation see prm file. Search for keyword "NXP support"&lt;BR /&gt;// the cons is also added into entries and added feature "volatile" to be sure&lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; it is not revomed by optimization. You should check the address in debugger &lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; or S19 record to be sure the data is there&lt;BR /&gt;// Be sure you are using correct routine to get data from flash :&lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; press Alt F7-&amp;gt; Compiler for HCS12 -&amp;gt; Options -&amp;gt; Code generation -&amp;gt; &lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;gt; Match PPAGE register is used for paging&lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write Runtime in the cell which appears.&lt;BR /&gt;//&amp;nbsp;&amp;nbsp; ..or write -CpPPAGE=RUNTIME into compiler option&lt;/P&gt;&lt;P&gt;// The compiler command line is also adjusted to be compiler informed we will&lt;BR /&gt;// use paged variables. The option "-D__FAR_DATA"&amp;nbsp; is added into &lt;BR /&gt;// the compiler command line (Alt F7-&amp;gt;Compiler for HC12 -&amp;gt; &lt;BR /&gt;//&amp;nbsp; -&amp;gt;Add -D__FAR_DATA in the Command Line Arguments)&lt;/P&gt;&lt;P&gt;//------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/16920i1FCBE43C9298AA0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;..or write -CpPPAGE=RUNTIME into compiler option…&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/17000i9F0296C1568DFB77/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When debug you use see:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/16964i166058FF09A50FF8/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this will lead you to solve your issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ladislav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2017 11:33:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613092#M13218</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2017-03-02T11:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: S12G128 P-Flash reading issue in bootloader</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613093#M13219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Iama,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for reply, unfortunately my issue still remains the same after adding these compilor options.&lt;/P&gt;&lt;P&gt;But when I'm trying debugging into assembly codes, especially going through the routine _LOAD_FAR_8, the root cause seems found:&lt;/P&gt;&lt;P&gt;The problem may be caused by wrong PPAGE address defined in datapage.c, it was defined 0x30 as below picture shows, but S12G128 PPAGE register is at 0x15.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/17326i75818C238B4BBA79/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This bug in AN4258 based bootloader may cause codes cannot use "* far" or "*__far" to read&amp;nbsp;banked data due to wrong PPAGE address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After modifying PPAGE_ADDR to correct address 0x15, data at Flash address 0x20000 (banked addr is 0xBBE00) can be read correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your support, and it would be good if you can add this finding to AN4258 new revision.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Walter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2017 13:09:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613093#M13219</guid>
      <dc:creator>walter_wang</dc:creator>
      <dc:date>2017-03-02T13:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: S12G128 P-Flash reading issue in bootloader</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613094#M13220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;which version of the CW you use? (No IDE version but CW4.1, 4.2,.5.0, 5.1, 5.2)&lt;/P&gt;&lt;P&gt;Could you please send me your project? You can use standard "support" way to nxp - just introduce email by hello Ladislav. (&lt;A href="https://community.nxp.com/docs/DOC-329745"&gt;https://community.nxp.com/docs/DOC-329745&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;P&gt;However, it would be better if you are able to send shortened, fuctional, issue highlighting version of the project.&lt;/P&gt;&lt;P&gt;(Do not forget to pack entire project. I hope you have set the project paths relative to project. The best is if everything is placed in the project folder)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you can send it to &lt;A href="mailto:hcs12@seznam.cz"&gt;hcs12@seznam.cz&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I'll check and correct it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ladislav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Mar 2017 07:51:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613094#M13220</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2017-03-03T07:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: S12G128 P-Flash reading issue in bootloader</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613095#M13221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Lasislav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using CW 5.1. We have done a lot of changes to bootloader to fit our application. Really sorry that I cannot send it due to RD policy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue is really simple and clear: the&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;PPAGE_ADDR definition in&amp;nbsp;&lt;SPAN&gt;datapage.c is not correct. Also, it is easy to re-produce, by just define a __far array in main.c and try to read it.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Walter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Apr 2017 08:55:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-P-Flash-reading-issue-in-bootloader/m-p/613095#M13221</guid>
      <dc:creator>walter_wang</dc:creator>
      <dc:date>2017-04-18T08:55:49Z</dc:date>
    </item>
  </channel>
</rss>

