<?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 MPC560xB - Bad RAM initialization at startup in MPC5xxx</title>
    <link>https://community.nxp.com/t5/MPC5xxx/MPC560xB-Bad-RAM-initialization-at-startup/m-p/671181#M7760</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;I use CodeWarrior 10.6 with CPU MPC5604B (MPC560xB Qorriva) and I find an error on default source file when I create a project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the file MPC5604B_HWInit.c there is the function INIT_Derivative():&lt;/P&gt;&lt;P&gt;__asm void INIT_Derivative(void) &lt;BR /&gt;{&lt;BR /&gt;nofralloc&lt;BR /&gt; /* Disable WatchDog*/&lt;BR /&gt; // *(volatile unsigned int*)0xfff38010 = 0x0000c520; &lt;BR /&gt; e_lis r9,0x0001&lt;BR /&gt; e_add16i r9,r9,-15072&lt;BR /&gt; e_lis r8,0xfff4&lt;BR /&gt; e_stw r9,-32752(r8)&lt;/P&gt;&lt;P&gt;// *(volatile unsigned int*) 0xfff38010 = 0x0000d928; &lt;BR /&gt; e_lis r9,0x0001&lt;BR /&gt; e_add16i r9,r9,-9944&lt;BR /&gt; e_lis r8,0xfff4&lt;BR /&gt; e_stw r9,-32752(r8)&lt;BR /&gt; // *(volatile unsigned int*) 0xfff38000 = 0xff00000A; &lt;BR /&gt; e_lis r3,0xff00&lt;BR /&gt; se_addi r3,0x000a&lt;BR /&gt; e_lis r8,0xfff4&lt;BR /&gt; e_stw r3,-32768(r8)&lt;BR /&gt; &lt;BR /&gt; /* SRAM initialization code*/&lt;BR /&gt; lis r11,L2SRAM_LOCATION@h&lt;BR /&gt; ori r11,r11,L2SRAM_LOCATION@l&lt;/P&gt;&lt;P&gt;/* Loops to cover L2SRAM, stmw allows 128 bytes (32 GPRS x 4 bytes) writes */&lt;BR /&gt; lis r12,L2SRAM_CNT@h&lt;BR /&gt; ori r12,r12,L2SRAM_CNT@l&lt;BR /&gt; mtctr r12&lt;/P&gt;&lt;P&gt;init_l2sram_loop:&lt;BR /&gt; stmw r0, 0(r11) /* Write 32 GPRs to SRAM*/&lt;BR /&gt;&lt;STRONG&gt; addi r11,r11,128 /* Inc the ram ptr; 32 GPRs * 4 bytes = 128B */&lt;/STRONG&gt;&lt;BR /&gt; bdnz init_l2sram_loop /* Loop for 48k of SRAM */&lt;BR /&gt; blr&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I set the important part of this function in bolt.&lt;/P&gt;&lt;P&gt;My problem is: the RAM is not initialized to value 0 by default.&lt;/P&gt;&lt;P&gt;Register r0 contains correctly value 0x00000000 (32 bits register) but there is other value write in all RAM memory.&lt;/P&gt;&lt;P&gt;But if I change the RAM access size from 128&amp;nbsp;to 4 bits the RAM is correctly initialized to value 0 as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where is the issue ? Bad initial source code or/and the ECU doesn't support 128 bits access ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Romain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Jun 2017 13:33:00 GMT</pubDate>
    <dc:creator>romainbenet</dc:creator>
    <dc:date>2017-06-23T13:33:00Z</dc:date>
    <item>
      <title>MPC560xB - Bad RAM initialization at startup</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC560xB-Bad-RAM-initialization-at-startup/m-p/671181#M7760</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;I use CodeWarrior 10.6 with CPU MPC5604B (MPC560xB Qorriva) and I find an error on default source file when I create a project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the file MPC5604B_HWInit.c there is the function INIT_Derivative():&lt;/P&gt;&lt;P&gt;__asm void INIT_Derivative(void) &lt;BR /&gt;{&lt;BR /&gt;nofralloc&lt;BR /&gt; /* Disable WatchDog*/&lt;BR /&gt; // *(volatile unsigned int*)0xfff38010 = 0x0000c520; &lt;BR /&gt; e_lis r9,0x0001&lt;BR /&gt; e_add16i r9,r9,-15072&lt;BR /&gt; e_lis r8,0xfff4&lt;BR /&gt; e_stw r9,-32752(r8)&lt;/P&gt;&lt;P&gt;// *(volatile unsigned int*) 0xfff38010 = 0x0000d928; &lt;BR /&gt; e_lis r9,0x0001&lt;BR /&gt; e_add16i r9,r9,-9944&lt;BR /&gt; e_lis r8,0xfff4&lt;BR /&gt; e_stw r9,-32752(r8)&lt;BR /&gt; // *(volatile unsigned int*) 0xfff38000 = 0xff00000A; &lt;BR /&gt; e_lis r3,0xff00&lt;BR /&gt; se_addi r3,0x000a&lt;BR /&gt; e_lis r8,0xfff4&lt;BR /&gt; e_stw r3,-32768(r8)&lt;BR /&gt; &lt;BR /&gt; /* SRAM initialization code*/&lt;BR /&gt; lis r11,L2SRAM_LOCATION@h&lt;BR /&gt; ori r11,r11,L2SRAM_LOCATION@l&lt;/P&gt;&lt;P&gt;/* Loops to cover L2SRAM, stmw allows 128 bytes (32 GPRS x 4 bytes) writes */&lt;BR /&gt; lis r12,L2SRAM_CNT@h&lt;BR /&gt; ori r12,r12,L2SRAM_CNT@l&lt;BR /&gt; mtctr r12&lt;/P&gt;&lt;P&gt;init_l2sram_loop:&lt;BR /&gt; stmw r0, 0(r11) /* Write 32 GPRs to SRAM*/&lt;BR /&gt;&lt;STRONG&gt; addi r11,r11,128 /* Inc the ram ptr; 32 GPRs * 4 bytes = 128B */&lt;/STRONG&gt;&lt;BR /&gt; bdnz init_l2sram_loop /* Loop for 48k of SRAM */&lt;BR /&gt; blr&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I set the important part of this function in bolt.&lt;/P&gt;&lt;P&gt;My problem is: the RAM is not initialized to value 0 by default.&lt;/P&gt;&lt;P&gt;Register r0 contains correctly value 0x00000000 (32 bits register) but there is other value write in all RAM memory.&lt;/P&gt;&lt;P&gt;But if I change the RAM access size from 128&amp;nbsp;to 4 bits the RAM is correctly initialized to value 0 as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where is the issue ? Bad initial source code or/and the ECU doesn't support 128 bits access ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Romain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jun 2017 13:33:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC560xB-Bad-RAM-initialization-at-startup/m-p/671181#M7760</guid>
      <dc:creator>romainbenet</dc:creator>
      <dc:date>2017-06-23T13:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: MPC560xB - Bad RAM initialization at startup</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC560xB-Bad-RAM-initialization-at-startup/m-p/671182#M7761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;There is no issue at all.&lt;/P&gt;&lt;P&gt;There in no need to have ram initialized with 0x0000 0000 patern.&lt;/P&gt;&lt;P&gt;And it is also not recommended to have all 0 in SRAM.&lt;/P&gt;&lt;P&gt;Your RAM will be initialed with R0 to R31 GPRs in 128bytes loops. And the address on R11 will be incremented by 128B.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2017 11:48:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC560xB-Bad-RAM-initialization-at-startup/m-p/671182#M7761</guid>
      <dc:creator>petervlna</dc:creator>
      <dc:date>2017-06-26T11:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: MPC560xB - Bad RAM initialization at startup</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC560xB-Bad-RAM-initialization-at-startup/m-p/671183#M7762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I understand that there is no necessary to initialze the RAM with a specified pattern.&lt;/P&gt;&lt;P&gt;But for my application I initialize or not a part of the RAM depending of DES register of RGM peripheral (DES = 0, no initialization, otherwise done).&lt;/P&gt;&lt;P&gt;How, in this case, can I be sure that (I can't know in advance value of the word in this RAM part) my data have the expected value ?&lt;/P&gt;&lt;P&gt;For example I use 2 bool data and 1 counter. At startup&amp;nbsp;if DES != 0 my 2 bool data and my counter are initialized with default function I&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;NIT_Derivative() and never modified between end of the function&amp;nbsp;&lt;SPAN&gt;INIT_Derivative() and the call of my function in my application (I have add the option NO_INIT_BSS in linker to remove default value of these data from function __init_data() )&lt;/SPAN&gt;&lt;/SPAN&gt;. What is the risk that my bool data are not by accident corrupted and&amp;nbsp;my counter is corrupted ? I can't afford to have this behaviour becuase this counter is used to enter in critical mode if its value is greater than a specified value.&lt;/P&gt;&lt;P&gt;What is the reason to avoid the initialization with 0x0000 0000 pattern ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help,&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Romain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2017 12:03:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC560xB-Bad-RAM-initialization-at-startup/m-p/671183#M7762</guid>
      <dc:creator>romainbenet</dc:creator>
      <dc:date>2017-06-26T12:03:30Z</dc:date>
    </item>
  </channel>
</rss>

