<?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: CodeWarrior startup routine and S12Z ECC RAM initialization</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CodeWarrior-startup-routine-and-S12Z-ECC-RAM-initialization/m-p/945361#M16630</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Edward,&lt;/P&gt;&lt;P&gt;I agree, it will be reported.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;BR,&amp;nbsp;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Jun 2019 07:30:58 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2019-06-21T07:30:58Z</dc:date>
    <item>
      <title>CodeWarrior startup routine and S12Z ECC RAM initialization</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CodeWarrior-startup-routine-and-S12Z-ECC-RAM-initialization/m-p/945358#M16627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After migration from Freescale to NXP it became unclear were to report bugs or concerns. Is Community really right place for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ECCSTAT RDY bit&amp;nbsp;explanation from S12ZVC RM:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ECC Ready— Shows the status of the ECC module.&lt;BR /&gt;0 Internal SRAM initialization is ongoing, access to the SRAM is disabled&lt;BR /&gt;1 Internal SRAM initialization is done, access to the SRAM is enabled&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CW startup routine seems not waiting for RDY==1. But setting reset vector to &lt;STRONG style="font-size: small; "&gt;iaprstvect&lt;/STRONG&gt;() routine&amp;nbsp;and power cycling board I see 0x0070 loop count&amp;nbsp;@ 0x3000. :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #7f0055; font-size: small; "&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt; &lt;STRONG&gt;_Startup&lt;/STRONG&gt;(&lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: small; "&gt;void&lt;/STRONG&gt;&lt;SPAN style="font-size: small;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #7f0055; font-size: small; "&gt;&lt;STRONG&gt;#pragma&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt; NO_RETURN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #7f0055; font-size: small;"&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt; &lt;STRONG&gt;iaprstvect&lt;/STRONG&gt;(&lt;/SPAN&gt;&lt;STRONG style="color: #7f0055; font-size: small; "&gt;void&lt;/STRONG&gt;&lt;SPAN style="font-size: small;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: small; "&gt;__asm&lt;/STRONG&gt;&lt;SPAN style="font-size: small;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CLR D2&lt;/P&gt;&lt;P&gt;rdlp:&amp;nbsp;&amp;nbsp;&amp;nbsp;INC D2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;BRCLR.B ECCSTAT, #0, rdlp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ST D2, 0x3000&amp;nbsp; // save loop count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;JMP _Startup&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like it takes quite a lot at power on to initialize ECC RAM. Long enough for&amp;nbsp;default startup routine to set stack pointer and jump (BSR) to DoZeroOut() routine before&amp;nbsp;ECC RAM initialization completes! Are there chances for big failure like reading wrong address from stack when returning back from DoZeroOut() to _Startup()?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2019 09:06:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CodeWarrior-startup-routine-and-S12Z-ECC-RAM-initialization/m-p/945358#M16627</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2019-06-19T09:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior startup routine and S12Z ECC RAM initialization</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CodeWarrior-startup-routine-and-S12Z-ECC-RAM-initialization/m-p/945359#M16628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Edward,&lt;/P&gt;&lt;P&gt;It doesn't matter whether you post it here or create a ticket.&lt;/P&gt;&lt;P&gt;But in this case, it doesn't seem to be a bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried the code you posted right in the _Startup function like this on S12ZVCA19 devkit&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;__EXTERN_C void _Startup(void) {
__asm{
       CLR D2
 rdlp: INC D2
       BRCLR.B ECCSTAT, #0, rdlp
       ST D2, 0x3000 // save loop count
}
 
__asm{
       LD S, #__SEG_END_SSTACK-1 /* initialize SP */
#ifdef __ALIGN_STACK_OPT__
 TFR S, D6 /* align SP to 4*/
 AND D6, #-4
 TFR D6, S
#endif 
}
 DoZeroOut();
 DoCopyDown();
#ifdef __cplusplus
 __static_init();
#endif
 main();
}&amp;nbsp;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The counter showed 0x70.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/88458i9EC11B567C40489B/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But if the code is modified to write the SRAM while RDY == 0, the execution stalls at the ST instruction and the SRAM is written once the SRAM has become ready.&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;__EXTERN_C void _Startup(void) {
 __asm{
       CLR D2
 rdlp: INC D2
       ST D2, 0x3000 // save loop count 
       BRCLR.B ECCSTAT, #0, rdlp 
}
 
 __asm {
       LD S, #__SEG_END_SSTACK-1 /* initialize SP */
#ifdef __ALIGN_STACK_OPT__
 TFR S, D6 /* align SP to 4*/
 AND D6, #-4
 TFR D6, S
#endif 
}
 DoZeroOut();
 DoCopyDown();
#ifdef __cplusplus
 __static_init();
#endif
 main();
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;IMG alt="pastedImage_2.png" src="https://community.nxp.com/t5/image/serverpage/image-id/88459iADBD05CA1B06F33D/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 14:26:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CodeWarrior-startup-routine-and-S12Z-ECC-RAM-initialization/m-p/945359#M16628</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2020-11-02T14:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior startup routine and S12Z ECC RAM initialization</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CodeWarrior-startup-routine-and-S12Z-ECC-RAM-initialization/m-p/945360#M16629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;I tried enabling&amp;nbsp;TIM0 and using TCNT to measure RDY delay time. Waiting for RDY=1 with leading&amp;nbsp;write to RAM vs no leading write to RAM produces about the same reading in TCNT and different&amp;nbsp;loop counter. Yes, it looks like a stall. Clearly S12ZVC RM is wrong and should be fixed. This is what&amp;nbsp;we have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7.3.4 Memory Initialization&lt;/P&gt;&lt;P&gt;To avoid spurious ECC error reporting, memory operations that allow a read before a first write (like the&lt;/P&gt;&lt;P&gt;read-modify-write operation of the unaligned access) require that the memory contains valid ECC values&lt;/P&gt;&lt;P&gt;before the first read-modify-write access is performed. The ECC module provides logic to initialize the&lt;/P&gt;&lt;P&gt;complete memory content with zero during the power up phase. During the initialization process the access&lt;/P&gt;&lt;P&gt;to the SRAM is disabled and the RDY status bit is cleared. &lt;STRONG&gt;If the initialization process is done&lt;/STRONG&gt;, SRAM&lt;/P&gt;&lt;P&gt;access is possible and the RDY status bit is set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Access disabled(ignored) vs stalled are not the same things. Bold part sounds as if initialization may never complete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2019 06:45:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CodeWarrior-startup-routine-and-S12Z-ECC-RAM-initialization/m-p/945360#M16629</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2019-06-21T06:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior startup routine and S12Z ECC RAM initialization</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CodeWarrior-startup-routine-and-S12Z-ECC-RAM-initialization/m-p/945361#M16630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Edward,&lt;/P&gt;&lt;P&gt;I agree, it will be reported.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;BR,&amp;nbsp;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2019 07:30:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CodeWarrior-startup-routine-and-S12Z-ECC-RAM-initialization/m-p/945361#M16630</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2019-06-21T07:30:58Z</dc:date>
    </item>
  </channel>
</rss>

