<?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>i.MX RT Crossover MCUsのトピックRandom Values in Shared OC RAM DualCore</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Random-Values-in-Shared-OC-RAM-DualCore/m-p/1530935#M21847</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;we have a problem with shared OC RAM of the iMXRT1176.&lt;/P&gt;&lt;P&gt;We use MCUXpresso v11.6.0 and SDK Version 2.12.0.&lt;/P&gt;&lt;P&gt;In MCUXpresso we have a Memory Section declared which holds Signals. The CM7 has read/write Access and the CM4 Read Only.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Flo1989_1-1664520527333.png" style="width: 540px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/195427i29B4F88AD5BC5B7A/image-dimensions/540x14?v=v2" width="540" height="14" role="button" title="Flo1989_1-1664520527333.png" alt="Flo1989_1-1664520527333.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In BoardConfigMPU of CM7 we configure the Section:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;extern uint32_t __base_SRAM_OC_Signals;
extern uint32_t __top_SRAM_OC_Signals;
uint32_t nonCacheSignalsStart = (uint32_t)(&amp;amp;__base_SRAM_OC_Signals);
uint32_t SignalsSize = (uint32_t)(&amp;amp;__top_SRAM_OC_Signals) - nonCacheSignalsStart;  

int i = 0;

    while ((SignalsSize &amp;gt;&amp;gt; i) &amp;gt; 0x1U)
    {
        i++;
    }

    if (i != 0)
    {
        /* The MPU region size should be 2^N, 5&amp;lt;=N&amp;lt;=32, region base should be multiples of size. */
        assert(!(nonCacheSignalsStart % SignalsSize));
        assert(SignalsSize == (uint32_t)(1 &amp;lt;&amp;lt; i));
        assert(i &amp;gt;= 5);

        /* Region 10 setting: Memory with Normal type, not shareable, non-cacheable */
        MPU-&amp;gt;RBAR = ARM_MPU_RBAR(12, nonCacheSignalsStart);
        MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_PRIV, 0, 1, 0, 0, 0, i - 1);
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and in CM4 BoardConfigMPU:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;extern uint32_t __base_SRAM_OC_Signals;
extern uint32_t __top_SRAM_OC_Signals;
uint32_t nonCacheSignalsStart = (uint32_t)(&amp;amp;__base_SRAM_OC_Signals);
uint32_t SignalsSize = (uint32_t)(&amp;amp;__top_SRAM_OC_Signals) - nonCacheSignalsStart;


int    i = 0;

    while ((SignalsSize &amp;gt;&amp;gt; i) &amp;gt; 0x1U)
    {
        i++;
    }

    if (i != 0)
    {
        /* The MPU region size should be 2^N, 5&amp;lt;=N&amp;lt;=32, region base should be multiples of size. */
        assert(!(nonCacheSignalsStart % SignalsSize));
        assert(SignalsSize == (uint32_t)(1 &amp;lt;&amp;lt; i));
        assert(i &amp;gt;= 5);

        /* Region 10 setting: Memory with Normal type, not shareable, non-cacheable */
        MPU-&amp;gt;RBAR = ARM_MPU_RBAR(3, nonCacheSignalsStart);
        MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_RO, 0, 1, 0, 0, 0, i - 1);
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On our Architecture we have a custom Bootloader, which executes first. Loads the CM7 and CM4 Images into ITC RAMs of the Cores and jumps to CM7 Core ResetISR().&lt;/P&gt;&lt;P&gt;The CM7 Core then Starts the CM4 Core via MCMGR.&lt;/P&gt;&lt;P&gt;On both Cores FreeRTOS is running, and we implemented a Software Reset over WatchDog, called form CM4 core.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void APP_GlobalSystemReset(void)
{
    wdog_config_t config;

    /*
     * wdogConfig-&amp;gt;enableWdog = true;
     * wdogConfig-&amp;gt;workMode.enableWait = true;
     * wdogConfig-&amp;gt;workMode.enableStop = false;
     * wdogConfig-&amp;gt;workMode.enableDebug = false;
     * wdogConfig-&amp;gt;enableInterrupt = false;
     * wdogConfig-&amp;gt;enablePowerdown = false;
     * wdogConfig-&amp;gt;resetExtension = flase;
     * wdogConfig-&amp;gt;timeoutValue = 0xFFU;
     * wdogConfig-&amp;gt;interruptTimeValue = 0x04u;
     */
    WDOG_GetDefaultConfig(&amp;amp;config);
    config.timeoutValue = 0x0U; /* Timeout value is (0x2 + 1)/2 = 0.5 sec. */
    WDOG_Init(BOOT_WDOG_BASE, &amp;amp;config);
    while (1)
    {
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If we have an Power On Reset the Application Starts and we have some Random Values in the OC_RAM of the Signals. Both Cores read the Random Values.&lt;/P&gt;&lt;P&gt;When we perform the Software Reset, the Values in the RAM are OK.&lt;/P&gt;&lt;P&gt;The problem occures also when i make a Debug session, where the custom Bootloader has no affect.&lt;/P&gt;&lt;P&gt;We have more Shared Sections where this doesn't happens.&lt;/P&gt;&lt;P&gt;Has anyone a solution for this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any explanation of this Code Line?&lt;/P&gt;&lt;P&gt;MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_PRIV, 0, 1, 0, 0, 0, i - 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;Florian&lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2022 07:27:15 GMT</pubDate>
    <dc:creator>Flo1989</dc:creator>
    <dc:date>2022-09-30T07:27:15Z</dc:date>
    <item>
      <title>Random Values in Shared OC RAM DualCore</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Random-Values-in-Shared-OC-RAM-DualCore/m-p/1530935#M21847</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;we have a problem with shared OC RAM of the iMXRT1176.&lt;/P&gt;&lt;P&gt;We use MCUXpresso v11.6.0 and SDK Version 2.12.0.&lt;/P&gt;&lt;P&gt;In MCUXpresso we have a Memory Section declared which holds Signals. The CM7 has read/write Access and the CM4 Read Only.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Flo1989_1-1664520527333.png" style="width: 540px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/195427i29B4F88AD5BC5B7A/image-dimensions/540x14?v=v2" width="540" height="14" role="button" title="Flo1989_1-1664520527333.png" alt="Flo1989_1-1664520527333.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In BoardConfigMPU of CM7 we configure the Section:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;extern uint32_t __base_SRAM_OC_Signals;
extern uint32_t __top_SRAM_OC_Signals;
uint32_t nonCacheSignalsStart = (uint32_t)(&amp;amp;__base_SRAM_OC_Signals);
uint32_t SignalsSize = (uint32_t)(&amp;amp;__top_SRAM_OC_Signals) - nonCacheSignalsStart;  

int i = 0;

    while ((SignalsSize &amp;gt;&amp;gt; i) &amp;gt; 0x1U)
    {
        i++;
    }

    if (i != 0)
    {
        /* The MPU region size should be 2^N, 5&amp;lt;=N&amp;lt;=32, region base should be multiples of size. */
        assert(!(nonCacheSignalsStart % SignalsSize));
        assert(SignalsSize == (uint32_t)(1 &amp;lt;&amp;lt; i));
        assert(i &amp;gt;= 5);

        /* Region 10 setting: Memory with Normal type, not shareable, non-cacheable */
        MPU-&amp;gt;RBAR = ARM_MPU_RBAR(12, nonCacheSignalsStart);
        MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_PRIV, 0, 1, 0, 0, 0, i - 1);
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and in CM4 BoardConfigMPU:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;extern uint32_t __base_SRAM_OC_Signals;
extern uint32_t __top_SRAM_OC_Signals;
uint32_t nonCacheSignalsStart = (uint32_t)(&amp;amp;__base_SRAM_OC_Signals);
uint32_t SignalsSize = (uint32_t)(&amp;amp;__top_SRAM_OC_Signals) - nonCacheSignalsStart;


int    i = 0;

    while ((SignalsSize &amp;gt;&amp;gt; i) &amp;gt; 0x1U)
    {
        i++;
    }

    if (i != 0)
    {
        /* The MPU region size should be 2^N, 5&amp;lt;=N&amp;lt;=32, region base should be multiples of size. */
        assert(!(nonCacheSignalsStart % SignalsSize));
        assert(SignalsSize == (uint32_t)(1 &amp;lt;&amp;lt; i));
        assert(i &amp;gt;= 5);

        /* Region 10 setting: Memory with Normal type, not shareable, non-cacheable */
        MPU-&amp;gt;RBAR = ARM_MPU_RBAR(3, nonCacheSignalsStart);
        MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_RO, 0, 1, 0, 0, 0, i - 1);
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On our Architecture we have a custom Bootloader, which executes first. Loads the CM7 and CM4 Images into ITC RAMs of the Cores and jumps to CM7 Core ResetISR().&lt;/P&gt;&lt;P&gt;The CM7 Core then Starts the CM4 Core via MCMGR.&lt;/P&gt;&lt;P&gt;On both Cores FreeRTOS is running, and we implemented a Software Reset over WatchDog, called form CM4 core.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void APP_GlobalSystemReset(void)
{
    wdog_config_t config;

    /*
     * wdogConfig-&amp;gt;enableWdog = true;
     * wdogConfig-&amp;gt;workMode.enableWait = true;
     * wdogConfig-&amp;gt;workMode.enableStop = false;
     * wdogConfig-&amp;gt;workMode.enableDebug = false;
     * wdogConfig-&amp;gt;enableInterrupt = false;
     * wdogConfig-&amp;gt;enablePowerdown = false;
     * wdogConfig-&amp;gt;resetExtension = flase;
     * wdogConfig-&amp;gt;timeoutValue = 0xFFU;
     * wdogConfig-&amp;gt;interruptTimeValue = 0x04u;
     */
    WDOG_GetDefaultConfig(&amp;amp;config);
    config.timeoutValue = 0x0U; /* Timeout value is (0x2 + 1)/2 = 0.5 sec. */
    WDOG_Init(BOOT_WDOG_BASE, &amp;amp;config);
    while (1)
    {
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If we have an Power On Reset the Application Starts and we have some Random Values in the OC_RAM of the Signals. Both Cores read the Random Values.&lt;/P&gt;&lt;P&gt;When we perform the Software Reset, the Values in the RAM are OK.&lt;/P&gt;&lt;P&gt;The problem occures also when i make a Debug session, where the custom Bootloader has no affect.&lt;/P&gt;&lt;P&gt;We have more Shared Sections where this doesn't happens.&lt;/P&gt;&lt;P&gt;Has anyone a solution for this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any explanation of this Code Line?&lt;/P&gt;&lt;P&gt;MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_PRIV, 0, 1, 0, 0, 0, i - 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;Florian&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 07:27:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Random-Values-in-Shared-OC-RAM-DualCore/m-p/1530935#M21847</guid>
      <dc:creator>Flo1989</dc:creator>
      <dc:date>2022-09-30T07:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Random Values in Shared OC RAM DualCore</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Random-Values-in-Shared-OC-RAM-DualCore/m-p/1534173#M21932</link>
      <description>&lt;P&gt;You can check ARM Cortex-M Reference Manual - MPU section and CMSIS source mpu_armv7.h to know below setting:&lt;/P&gt;
&lt;P&gt;MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_PRIV, 0, 1, 0, 0, 0, i - 1);&lt;/P&gt;
&lt;P&gt;Basically, It means the memory region property is Normal type, not shareable, non-cacheable, Access Permission privileged access only&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 03:37:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Random-Values-in-Shared-OC-RAM-DualCore/m-p/1534173#M21932</guid>
      <dc:creator>jay_heng</dc:creator>
      <dc:date>2022-10-08T03:37:45Z</dc:date>
    </item>
  </channel>
</rss>

