iMXRT1024 FlexRAM configuration

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMXRT1024 FlexRAM configuration

Jump to solution
785 Views
NathanKM
Contributor I

Dear all,

 

I have a custom board with an IMXRT1024 and an external RAM. I want to get rid of the external RAM since my software development is done and i have made some optimization. I need around 205kB of RAM for my application to run. Also note that my application run FreeRTOS (change value in FreeRTOSConfig.h to fit my need).

 

I know that the default FlexRAM configuration is 128kB OCRAM - 64kB ITCM - 64kB DTCM. I want to maximize RAM capacity for future needs, so i understood that i can configure FlexRAM to increase OCRAM to 256kB or DTCM to 256kB (and turn other RAM controller off). I followed all steps of this guide : Reallocating the FlexRAM - NXP Community

So i did :

- Add in ResetISR for OCRAM 256kB (I did not add the IOMUXC_GPR_GPR14 register modification since it's not the same for RT106x and RT1024) :

 

/* Reallocating the FlexRAM */
    __asm (".syntax unified\n"

    "LDR R0,=0x20001fff\n" //load initial value of stack pointer into R0
    "MSR MSP,R0\n"//re-initialize stack pointer by new value

    "LDR R0, =0x400ac044\n"//Address of register IOMUXC_GPR_GPR17
    "LDR R1, =0xaaaa5555\n"//FlexRAM configuration DTC = 0KB, ITC = 0KB, OC = 256KB
    "STR R1,[R0]\n"

    "LDR R0,=0x400ac040\n"//Address of register IOMUXC_GPR_GPR16
    "LDR R1,[R0]\n"
    "ORR R1,R1,#4\n"//The 4 corresponds to setting the FLEXRAM_BANK_CFG_SEL bit in register IOMUXC_GPR_GPR16
    "STR R1,[R0]\n"

    #ifdef FLEXRAM_ITCM_ZERO_SIZE
    "LDR R0,=0x400ac040\n"//Address of register IOMUXC_GPR_GPR16
    "LDR R1,[R0]\n"
    "AND R1,R1,#0xfffffffe\n"//Disabling SRAM_ITC in register IOMUXC_GPR_GPR16
    "STR R1,[R0]\n"
    #endif

    #ifdef FLEXRAM_DTCM_ZERO_SIZE
    "LDR R0,=0x400ac040\n"//Address of register IOMUXC_GPR_GPR16
    "LDR R1,[R0]\n"
    "AND R1,R1,#0xfffffffd\n"//Disabling SRAM_DTC in register IOMUXC_GPR_GPR16
    "STR R1,[R0]\n"
    #endif

    ".syntax divided\n");

 

- Modify the linker setting to match the new values

- Change BOARD_ConfigMPU function by comment region 5 and 6 (ITCM and DCTM) and change region 7 (OCRAM) size to ARM_MPU_REGION_SIZE_256KB

- Change the image entry address in fsl_flexspi_nor_boot.c 

- In C/C++ Build --> Manage Linker Script, change stack location to start. Also, since i disable DTCM controller i though it won't be great for the stack to stay in SRAM_DTC region so i switch it for OCRAM.

 

After those modification, i tried to run a debug with my JLink probe but i got the deadbeee error in my MCUXpresso IDE. I've read a lot about flashdriver but don't seem to be the issue here since i can download the flash program.

 

This is no new topic, i've seen a lot of post about the FlexRAM configuration (FlexRAM Unexpected Behaviour - NXP Community, Solved: iMXRT1021 change FlexRAM size - NXP Community, etc...) and i knew it won't be simple.

 

My questions are :

  1. Is my configuration(s) possible ? (256kB OCRAM - 0kB ITCM - 0kB DTCM OR 0kB OCRAM - 0kB ITCM - 256kB DTCM) 
  2. Am i doing it right with my modification compare to the guide based on IMXRT106x ?

 

Regards

 

Labels (1)
0 Kudos
1 Solution
757 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @NathanKM ,

Yes, you can reallocate all flexram to ocram or dtcm. The attachment give dtcm 256k space. You should modify xxx_startup.s, .icf and board.c.

 

Regards,

Jing

View solution in original post

0 Kudos
4 Replies
744 Views
dasfaas
Contributor II

Hi @NathanKM 

You can do this alright, doing exactly the same. Just note that the NXP bootloader requires two banks of 32kB allocated to OCRAM for it to operate if you do a soft-reset (it's questionably labelled COLD reset in the reference manual). If you allocate all 256kB to DTCM, then the bootloader won't function after a soft-reset. If you have a watchdog reset or some other crash (anything except a POR), you must ensure that OCRAM has 64kB allocated to it.

Have fun,

Ger

0 Kudos
752 Views
NathanKM
Contributor I

Hi Jingpan,

 

Thanks for the reply. I indeed see your modifications and took note. I have some questions :

  1. You have changed the flashdriver to "Newer_MIMXRT1024.cfx", am i right to assume you followed this guide here ? How to create a new Flash driver of the MCUXPresso... - NXP Community
  2. In ResetISR, you set to 0 bit 20 and 16 of IOMUXC_GPR14 but according to IMXRT1024 documentation it is reserved bit. Can i have more information about this ?
    NathanKM_0-1676543805832.png
  3. Last but not least, i am not totally used to MCUXpresso so i guess "modify .icf" refer to changing setting in properties -> MCU settings ? 

 

Thanks again for the support

 

Regards

0 Kudos
709 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @NathanKM ,

This is a IAR project, not mcuxpresso project.

.icf is link file. Please refer to MIMXRT1021xxxxx_flexspi_nor.icf. You can read it.

I didn't modify flash algorithm. I think you need modify .cfx too. It runs before you change the flexram settings. You need worry about FlexRAM is disabled before download algorithm. The connect script will reset the flexram before download algorithm. You can read RT1024_connect.scp.

jingpan_0-1676885502084.png

 

Regards,

Jing

 

0 Kudos
758 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @NathanKM ,

Yes, you can reallocate all flexram to ocram or dtcm. The attachment give dtcm 256k space. You should modify xxx_startup.s, .icf and board.c.

 

Regards,

Jing

0 Kudos