AnsweredAssumed Answered

Relocating majority of application into RAM

Question asked by Peter Janco on Oct 8, 2018
Latest reply on Oct 19, 2018 by Peter Janco


I try to reconfigure SDK example project "driver_examples/csi/csi_rgb565" to use different memory layout. I can not do this and I need help.


My target configuration is to have majority of code in internal ITC memory, all read only data in internal DTC memory, stack in internal DTC memory, global variables in internal OC memory, big camera RBB565 buffers in external SDRAM, heap in external SDRAM. I am following steps in manual "MCUXpresso IDE User Guide>Memory Configuration and Linker Scripts>FreeMarker Linker Script Template Examples/Relocating majority of application into RAM".


This is my MCU settings:


This is my managed linker script configuration:


I also create "linkscripts" folder with three files:



<#if memory.alias=="RAM2">
        . = ALIGN(${text_align});
<#if memory.alias=="RAM">
        *(.rodata .rodata.* .constdata .constdata.*)
        . = ALIGN(${text_align});



*startup_*.o (.rodata .rodata.* .constdata .constdata.*)
. = ALIGN(${text_align});



*startup_*.o (.text.*)


I am able to compile my project:

Memory region         Used Size  Region Size  %age Used
     BOARD_FLASH:       41336 B        64 MB      0.06%
        SRAM_DTC:        8604 B       128 KB      6.56%
        SRAM_ITC:       25596 B       128 KB     19.53%
         SRAM_OC:         436 B       256 KB      0.17%
     BOARD_SDRAM:          1 MB        32 MB      3.13%
Finished building target: evkbimxrt1050_csi_rgb565_2.axf


But after I upload program binary it to my IMXRT1050-EVKB board it stop with this error:


What I am doing wrong?


If I use the same configuration but without this:

<#if memory.alias=="RAM2">
        . = ALIGN(${text_align});

Then it is working. So, the only problem is ITC memory, rest of my memory layout seems to be functional.


In original linker script file "MIMXRT1052xxxxx_flexspi_nor.ld" is the SDRAM memory splited into two regions. First have 30MB and second 2MB. Camera RGB565 buffer is in smaller 2MB region.


Why is SDRAM splitted into two regions?