AnsweredAssumed Answered

XPC567XRKIT: How to use external SRAM correctly

Question asked by nuaa_zp on Apr 26, 2020
Latest reply on May 21, 2020 by nuaa_zp

Hello everybody,

I am facing an issue on   MPC567XKIT516-PT Development board. MCU is MPC5674F.

The internal SRAM is too little to handle my program,so I want to use an external SRAM. I have successfully initialized external SRAM according to the sample(XPC567XRKIT PinToggleStationery CW210 example,SRAM is CY7C1338 and this is 4Mbit memory,address range is 0x2000_0000 - 0x2007FFFF),and test OK by using the follow code:

/* test write */
*(vuint32_t*)(0x20000000) = 0xAA55AA55;

/* test read */
longword0 = *(vuint32_t*)(0x20000000);

/* evaluation */
if (longword0 == 0xAA55AA55)
{
         printf("External SRAM initialized properly\r\n");
}
else
{
         printf("External SRAM test failed\r\n");
}

 

But I don't know how to add it to memory,for example, when used, the compiler can automatically allocate memory.

I think the LCF file needs to be modified (debug mode),But when I change the following variables 'pseudo_rom or internal_ram' to 'external_ram', the program will run abnormally. Please tell me how to use external SRAM correctly.@#@@

MEMORY
{

      external_ram: org = 0x20000000, len = 0x00080000     //My changes
      pseudo_rom: org = 0x40008000, len = 0x00020000
      init: org = 0x40028000, len = 0x00001000
      exception_handlers: org = 0x40029000, len = 0x00001000
      internal_ram: org = 0x4002A000, len = 0x00014000
      heap : org = 0x4003E000, len = 0x00001000 /* Heap start location */
      stack : org = 0x4003F000, len = 0x00001000 /* Start location for Stack */
}

SECTIONS
{
      GROUP : {
                  .init : {}
                  .init_vle (VLECODE) : {
                  *(.init)
                  *(.init_vle)
                           }
                  } > init

.__exception_handlers (VLECODE): {} > exception_handlers

GROUP : {
         .text (TEXT) ALIGN(0x10) : {}
         .text_vle (VLECODE) ALIGN(0x10): {
         *(.text)
         *(.text_vle)
                     }
            .rodata (CONST) : {
         *(.rdata)
         *(.rodata)
            }
         .ctors : {}
         .dtors : {}
         extab : {}
         extabindex : {}
         } > pseudo_rom

GROUP : {
         .__uninitialized_intc_handlertable ALIGN(0x10) : {}
         .data : {}
         .sdata : {}
         .sbss : {}
         .sdata2 : {}
         .sbss2 : {}
         .bss : {}
         } > internal_ram
}

 

 

Thank you in advance for your help!

 

peng

Outcomes