Thomas Pomphrey

MCF52258 External RAM definition and usage

Discussion created by Thomas Pomphrey on May 26, 2011
Latest reply on May 27, 2011 by Thomas Pomphrey

I am currently working on a project that is based on  a design quite similar to the MCF52259 Evaluation Board. I need to test the Mini-FlexBus external RAM interface. I'm using a MR2A16ACYS35 512K byte MRAM attached to the Mini-FlexBus for external storage.


The  Mini-FlexBus has been properly initialized and I have verified that we can successfully read and write to the MRAM using a routine written in C that utilizes direct pointer addressing. I have modified our linker control file adding the proper addressing and segment names and verified that the map file properly reflects the modifications after building our application.



# Sample Linker Command File for CodeWarrior for ColdFire

KEEP_SECTION {.vectortable}

# Memory ranges

   vectorrom    (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
   cfmprotrom      (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000020
   code            (RX)  : ORIGIN = 0x00000500, LENGTH = 0x0007FB00
   vectorram       (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00000400
   userram         (RWX) : ORIGIN = 0x20000400, LENGTH = 0x0000C900
   xram            (RW)  : ORIGIN = 0x80000000, LENGTH = 0x0007FFFF


# Heap and Stack sizes definition
    ___heap_size      = 0x1000;
    ___stack_size     = 0x1000;

# MCF52259 Derivative Memory map definitions from linker command files:
# symbols must be defined in the linker command file.

# Memory Mapped Registers (IPSBAR= 0x40000000)
   ___IPSBAR         = 0x40000000;

# 64 Kbytes Internal SRAM
   ___RAMBAR         = 0x20000000;
   ___RAMBAR_SIZE    = 0x0000FFFF;

# 512 KByte Internal Flash Memory
   ___FLASHBAR       = 0x00000000;
   ___FLASHBAR_SIZE  = 0x00080000;

# 512 KByte External RAM Memory
   ___XRAMBAR       = 0x80000000;
   ___XRAMBAR_SIZE  = 0x0007FFFF;  


  .userram        : {} > userram
  .code            : {} > code
  .vectorram    : {} > vectorram
  .xram            : {} > xram


I need to store selected variables in this section of memory using a manner similar to how variables are stored in Flash memory using a keyword to preface the variable name that will force the linker to store the variable in a MRAM location as opposed to the internal SRAM of the device. Does anyone have an example of how to do this? My external MRAM is labeled (see above) as "xram."