<?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 Re: iMXRT1021 change FlexRAM size in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/iMXRT1021-change-FlexRAM-size/m-p/1316483#M15601</link>
    <description>&lt;P&gt;Thanks Jery.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;It's work &lt;LI-EMOJI id="lia_grinning-face-with-smiling-eyes" title=":grinning_face_with_smiling_eyes:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Aug 2021 06:46:55 GMT</pubDate>
    <dc:creator>huy_tv</dc:creator>
    <dc:date>2021-08-02T06:46:55Z</dc:date>
    <item>
      <title>iMXRT1021 change FlexRAM size</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/iMXRT1021-change-FlexRAM-size/m-p/1316196#M15583</link>
      <description>&lt;P&gt;Dear all,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a trouble with FlexRAM resize.&lt;BR /&gt;Following reference&amp;nbsp;&lt;A href="https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/Reallocating-the-FlexRAM/ta-p/1117649" target="_self"&gt;Reallocating-the-FlexRAM&lt;/A&gt;&amp;nbsp;, i can change IMXRT1021 ram size (ITC-OC-DTC) from default (64KB-128KB-64KB) to new value (64KB-64KB-128KB).&lt;BR /&gt;After flash program with Jlink, device can success boot up, run application without any problems.&amp;nbsp;&lt;BR /&gt;When i call &lt;STRONG&gt;software reset&lt;/STRONG&gt; (NVIC_SystemReset), &lt;STRONG&gt;device still booting up again and work fine&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;But when i turnoff power source and turn on again, device never run to application success. Could you please give me your suggestion?&lt;BR /&gt;Thank you.&lt;/P&gt;&lt;P&gt;Edit1: With default RAM config, device can boot ok, booting problem only happen when i relocate FlexRAM&lt;BR /&gt;&lt;BR /&gt;This is my configuration for relocate FlexRAM&lt;BR /&gt;1. Reset handler&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void ResetISR(void) {

    // Disable interrupts
    __asm volatile ("cpsid i");

// For debug only
    volatile unsigned int IOMUXC_GPR_GPR17_Reg = *((unsigned int *) 0x400ac044);
    volatile unsigned int IOMUXC_GPR_GPR16_Reg = *((unsigned int *) 0x400ac040);
//

    /* Reallocating the FlexRAM */
    __asm (".syntax unified\n"

    "LDR R0, =0x400ac044\n" //Address of register IOMUXC_GPR_GPR17
    "LDR R1, =0x00005FAA\n" //FlexRAM configuration DTC = 128KB, ITC = 64KB, OC = 64KB
    "STR R1,[R0]\n"


    ".syntax divided\n");

    __asm volatile ("MSR MSP, %0" : : "r" (&amp;amp;_vStackTop) : );
...........
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2. MPU config for new FlexRAM configuration&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* Region 4 setting: Memory with Device type, not shareable, non-cacheable. */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(4, 0x00000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);

    /* Region 5 setting: Memory with Normal type, not shareable, outer/inner write back */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(5, 0x00000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_64KB);

    /* Region 6 setting: Memory with Normal type, not shareable, outer/inner write back */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(6, 0x20000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB);

    /* Region 7 setting: Memory with Normal type, not shareable, outer/inner write back */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(7, 0x20200000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_64KB);

    /* Region 8 setting: Memory with Normal type, not shareable, outer/inner write back */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(8, 0x80000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Linker option&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="huy_tv_0-1627698630703.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/151434iEA0B8E3508D42A1F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="huy_tv_0-1627698630703.png" alt="huy_tv_0-1627698630703.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;4. XIP Nor option&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="huy_tv_1-1627698768322.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/151435i39B88618DB3C3CED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="huy_tv_1-1627698768322.png" alt="huy_tv_1-1627698768322.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 08:13:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/iMXRT1021-change-FlexRAM-size/m-p/1316196#M15583</guid>
      <dc:creator>huy_tv</dc:creator>
      <dc:date>2021-07-31T08:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: iMXRT1021 change FlexRAM size</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/iMXRT1021-change-FlexRAM-size/m-p/1316350#M15592</link>
      <description>&lt;P&gt;Hi，&lt;BR /&gt;Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support, I'd highly recommend you to use the below code instead of the original one and give it a try again.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;void ResetISR(void) {

    // Disable interrupts
    __asm volatile ("cpsid i");

 
    //FlexRAM reallocate: ITC-OC-DTC(64KB-64KB-128KB)
    FLEXRAM-&amp;gt;TCM_CTRL = 4;
    IOMUXC_GPR-&amp;gt;GPR17 = 0x0000FAA5;
    IOMUXC_GPR-&amp;gt;GPR16 |= 0x7;
    IOMUXC_GPR-&amp;gt;GPR14 =  (8&amp;lt;&amp;lt;20) | (7&amp;lt;&amp;lt;16) ;

#if defined (__USE_CMSIS)
// If __USE_CMSIS defined, then call CMSIS SystemInit code
    SystemInit();
#else
    // Disable Watchdog
    volatile unsigned int *WDOG1_WCR = (unsigned int *) 0x400B8000;
    *WDOG1_WCR = *WDOG1_WCR &amp;amp; ~(1 &amp;lt;&amp;lt; 2);
    volatile unsigned int *WDOG2_WCR = (unsigned int *) 0x400D0000;
    *WDOG2_WCR = *WDOG2_WCR &amp;amp; ~(1 &amp;lt;&amp;lt; 2);
    // Write watchdog update key to unlock
    *((volatile unsigned int *)0x400BC004) = 0xD928C520;
    // Set timeout value
    *((volatile unsigned int *)0x400BC008) = 0xFFFF;
    // Now disable watchdog via control register
    volatile unsigned int *RTWDOG_CS = (unsigned int *) 0x400BC000;
    *RTWDOG_CS = (*RTWDOG_CS &amp;amp; ~(1 &amp;lt;&amp;lt; 7)) | (1 &amp;lt;&amp;lt; 5);

#endif // (__USE_CMSIS)

    //
    // Copy the data sections from flash to SRAM.
    //
    unsigned int LoadAddr, ExeAddr, SectionLen;
    unsigned int *SectionTableAddr;

    // Load base address of Global Section Table
    SectionTableAddr = &amp;amp;__data_section_table;

    // Copy the data sections from flash to SRAM.
    while (SectionTableAddr &amp;lt; &amp;amp;__data_section_table_end) {
        LoadAddr = *SectionTableAddr++;
        ExeAddr = *SectionTableAddr++;
        SectionLen = *SectionTableAddr++;
        data_init(LoadAddr, ExeAddr, SectionLen);
    }

    // At this point, SectionTableAddr = &amp;amp;__bss_section_table;
    // Zero fill the bss segment
    while (SectionTableAddr &amp;lt; &amp;amp;__bss_section_table_end) {
        ExeAddr = *SectionTableAddr++;
        SectionLen = *SectionTableAddr++;
        bss_init(ExeAddr, SectionLen);
    }


#if !defined (__USE_CMSIS)
// Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
// will setup the VTOR register

    // Check to see if we are running the code from a non-zero
    // address (eg RAM, external flash), in which case we need
    // to modify the VTOR register to tell the CPU that the
    // vector table is located at a non-0x0 address.
    unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
    if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) {
        *pSCB_VTOR = (unsigned int)g_pfnVectors;
    }
#endif // (__USE_CMSIS)
#if defined (__cplusplus)
    //
    // Call C++ library initialisation
    //
    __libc_init_array();
#endif

    // Reenable interrupts
    __asm volatile ("cpsie i");

#if defined (__REDLIB__)
    // Call the Redlib library, which in turn calls main()
    __main();
#else
    main();
#endif

    //
    // main() shouldn't return, but if it does, we'll just enter an infinite loop
    //
    while (1) {
        ;
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;
&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 03:07:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/iMXRT1021-change-FlexRAM-size/m-p/1316350#M15592</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2021-08-02T03:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: iMXRT1021 change FlexRAM size</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/iMXRT1021-change-FlexRAM-size/m-p/1316483#M15601</link>
      <description>&lt;P&gt;Thanks Jery.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;It's work &lt;LI-EMOJI id="lia_grinning-face-with-smiling-eyes" title=":grinning_face_with_smiling_eyes:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 06:46:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/iMXRT1021-change-FlexRAM-size/m-p/1316483#M15601</guid>
      <dc:creator>huy_tv</dc:creator>
      <dc:date>2021-08-02T06:46:55Z</dc:date>
    </item>
  </channel>
</rss>

