<?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: S12zVl preserving RAM location during cop reset</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12zVl-preserving-RAM-location-during-cop-reset/m-p/937364#M16604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The data sheet states:&lt;/P&gt;&lt;P&gt;1.12.3.4 RAM&lt;BR /&gt;The system RAM arrays, including their ECC syndromes, are initialized following a power on reset.&lt;BR /&gt;With the exception of a power-on-reset the RAM content is unaltered by a reset occurrence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only issue you have to solve is processing of the code after COP reset. If you use CodeWarriror which contains initialization&amp;nbsp; routines (for variables and constants) placed in the file start12.c.&lt;/P&gt;&lt;P&gt;The functions for initialization the RAM, constant , variables...placement is a module Start12z.c&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/88316iE68D362ADE6D53B6/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;If you do not want to use initialization routines then you must recognize COP reset after reset event (register)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (CPMURFLG_COPRF) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // COP reset has started the process&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, the function and modification must be a part of Start12z.c....original code in Start12z.c is:&lt;/P&gt;&lt;P&gt;(_Startup(void) is a function where POR, COP,.. reset vector points to.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__EXTERN_C void _Startup(void) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;__asm {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;LD S, #__SEG_END_SSTACK-1&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* initialize SP */&lt;BR /&gt;#ifdef __ALIGN_STACK_OPT__&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TFR S, D6&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* align SP to 4*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;AND D6, #-4&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TFR D6, S&lt;BR /&gt;#endif&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DoZeroOut();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DoCopyDown();&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;__static_init();&lt;BR /&gt;#endif&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;main();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to suggest you to check what DoZeroOut and DoCopyDown performs to be able to correctly place the condition "if (CPMURFLG_COPRF)".&lt;/P&gt;&lt;P&gt;Sometimes it is suitable to perform "TOTAL" modification of the fila Start12z.c if you want to have EVERYTHING under your control. In this case, however, you are then responsible for correct initialization of variables after POR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course &lt;STRONG&gt;there is also another possibility&lt;/STRONG&gt; which ensures no automatic access of CodeWarrior Initialization procedures to the RAM. The way is modificatin of the PRM file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify RAM segment...split it to segment controlled by CW and segment not initialized.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_16.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88319iEDF15C11B1147FA4/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_16.png" alt="pastedImage_16.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and also Placement :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_17.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88320iDB8AFBDB00B7565D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_17.png" alt="pastedImage_17.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, In the main.c file I will use two different approaches to visualize performance :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_10.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88321i5585A4037C7E7B3F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_10.png" alt="pastedImage_10.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;note, I used static&amp;nbsp; and volatile qualifiers to avoid optimization process to exclude variables from the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After reset (stopped at the beginning/top of the main() function) I can see i, j, k as no initialized but ii, jj, kk are initialized after Start12z file processing.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_9.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88322i5F90B7D7E1B9DD56/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_9.png" alt="pastedImage_9.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I step through:&lt;/P&gt;&lt;P&gt;void main(void) &lt;BR /&gt;{&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; i = 11;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; j = 12; &lt;BR /&gt;&amp;nbsp; k = 13;&lt;BR /&gt;&amp;nbsp; ii = 14;&lt;BR /&gt;&amp;nbsp; jj = 15; &lt;BR /&gt;&amp;nbsp; kk = 16;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and now reset, then after execution of Start 12z.c and stopped at the beginning/top of the main() function I can see:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_15.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88323i3300F72ABF9AEF8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_15.png" alt="pastedImage_15.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;....soft reset has not changed content of i, j, k&amp;nbsp; (&lt;STRONG&gt;even I used initialization "static unsigned char volatile i=1,j=2,k=3;" but PLACEMENT to NO_INIT section has higher priority&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result....ii, jj, kk are always modified and initialized after reset in the initialization function placed in the Start12z.c file. i,j,k are not modified because they are placed in the RAM_NO_INIT, my user space, which is not initialized after reset what was defined in the prm file by creating exttra RAM space for unitialized variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have provided you two different approaches and now it is up to you which one is more suitable for you or you can use combination of both of them.&lt;/P&gt;&lt;P&gt;&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>Wed, 19 Jun 2019 08:55:33 GMT</pubDate>
    <dc:creator>lama</dc:creator>
    <dc:date>2019-06-19T08:55:33Z</dc:date>
    <item>
      <title>S12zVl preserving RAM location during cop reset</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12zVl-preserving-RAM-location-during-cop-reset/m-p/937363#M16603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;we need to preserve one RAM location after COP reset.&lt;/P&gt;&lt;P&gt;please suggest, how we can achieve this in S12ZVL ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Charudatta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2019 09:45:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12zVl-preserving-RAM-location-during-cop-reset/m-p/937363#M16603</guid>
      <dc:creator>charudattaingal</dc:creator>
      <dc:date>2019-06-18T09:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: S12zVl preserving RAM location during cop reset</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12zVl-preserving-RAM-location-during-cop-reset/m-p/937364#M16604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The data sheet states:&lt;/P&gt;&lt;P&gt;1.12.3.4 RAM&lt;BR /&gt;The system RAM arrays, including their ECC syndromes, are initialized following a power on reset.&lt;BR /&gt;With the exception of a power-on-reset the RAM content is unaltered by a reset occurrence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only issue you have to solve is processing of the code after COP reset. If you use CodeWarriror which contains initialization&amp;nbsp; routines (for variables and constants) placed in the file start12.c.&lt;/P&gt;&lt;P&gt;The functions for initialization the RAM, constant , variables...placement is a module Start12z.c&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/88316iE68D362ADE6D53B6/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;If you do not want to use initialization routines then you must recognize COP reset after reset event (register)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (CPMURFLG_COPRF) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // COP reset has started the process&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, the function and modification must be a part of Start12z.c....original code in Start12z.c is:&lt;/P&gt;&lt;P&gt;(_Startup(void) is a function where POR, COP,.. reset vector points to.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__EXTERN_C void _Startup(void) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;__asm {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;LD S, #__SEG_END_SSTACK-1&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* initialize SP */&lt;BR /&gt;#ifdef __ALIGN_STACK_OPT__&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TFR S, D6&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* align SP to 4*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;AND D6, #-4&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TFR D6, S&lt;BR /&gt;#endif&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DoZeroOut();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DoCopyDown();&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;__static_init();&lt;BR /&gt;#endif&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;main();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to suggest you to check what DoZeroOut and DoCopyDown performs to be able to correctly place the condition "if (CPMURFLG_COPRF)".&lt;/P&gt;&lt;P&gt;Sometimes it is suitable to perform "TOTAL" modification of the fila Start12z.c if you want to have EVERYTHING under your control. In this case, however, you are then responsible for correct initialization of variables after POR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course &lt;STRONG&gt;there is also another possibility&lt;/STRONG&gt; which ensures no automatic access of CodeWarrior Initialization procedures to the RAM. The way is modificatin of the PRM file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify RAM segment...split it to segment controlled by CW and segment not initialized.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_16.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88319iEDF15C11B1147FA4/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_16.png" alt="pastedImage_16.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and also Placement :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_17.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88320iDB8AFBDB00B7565D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_17.png" alt="pastedImage_17.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, In the main.c file I will use two different approaches to visualize performance :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_10.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88321i5585A4037C7E7B3F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_10.png" alt="pastedImage_10.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;note, I used static&amp;nbsp; and volatile qualifiers to avoid optimization process to exclude variables from the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After reset (stopped at the beginning/top of the main() function) I can see i, j, k as no initialized but ii, jj, kk are initialized after Start12z file processing.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_9.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88322i5F90B7D7E1B9DD56/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_9.png" alt="pastedImage_9.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I step through:&lt;/P&gt;&lt;P&gt;void main(void) &lt;BR /&gt;{&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; i = 11;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; j = 12; &lt;BR /&gt;&amp;nbsp; k = 13;&lt;BR /&gt;&amp;nbsp; ii = 14;&lt;BR /&gt;&amp;nbsp; jj = 15; &lt;BR /&gt;&amp;nbsp; kk = 16;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and now reset, then after execution of Start 12z.c and stopped at the beginning/top of the main() function I can see:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_15.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/88323i3300F72ABF9AEF8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_15.png" alt="pastedImage_15.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;....soft reset has not changed content of i, j, k&amp;nbsp; (&lt;STRONG&gt;even I used initialization "static unsigned char volatile i=1,j=2,k=3;" but PLACEMENT to NO_INIT section has higher priority&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result....ii, jj, kk are always modified and initialized after reset in the initialization function placed in the Start12z.c file. i,j,k are not modified because they are placed in the RAM_NO_INIT, my user space, which is not initialized after reset what was defined in the prm file by creating exttra RAM space for unitialized variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have provided you two different approaches and now it is up to you which one is more suitable for you or you can use combination of both of them.&lt;/P&gt;&lt;P&gt;&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>Wed, 19 Jun 2019 08:55:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12zVl-preserving-RAM-location-during-cop-reset/m-p/937364#M16604</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2019-06-19T08:55:33Z</dc:date>
    </item>
  </channel>
</rss>

