This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48L952 hercules mapping Variable to External EMIF/SDRAM on Board

Other Parts Discussed in Thread: RM48L952, HALCOGEN

Hi, we are using the Hercules RM48L952 board. We want to map an array to the external SDRAM. We understood that the RM48 part is ARM based. Is this correct? Is it then possible to do as ARM documentation suggests (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/1500.html:

The emif/sdram is enabled and in the halcogen sys_link.cmd file is configured to access the sdram as follows

MEMORY
{
    VECTORS (X)  : origin=0x00000000 length=0x00000020
    FLASH0  (RX) : origin=0x00000020 length=0x0017FFE0
    FLASH1  (RX) : origin=0x00180000 length=0x00180000
    STACKS  (RW) : origin=0x08000000 length=0x00000900
    RAM     (RW) : origin=0x08000900 length=0x0003f700

/* USER CODE BEGIN (2) */
    SDRAM (RW)    : origin=0x80000000 length=0x00200000
/* USER CODE END */
}


/*----------------------------------------------------------------------------*/
/* Section Configuration                                                      */

SECTIONS
{
    .intvecs : {} > VECTORS
    .text    : {} > FLASH0 | FLASH1
    .const   : {} > FLASH0 | FLASH1
    .cinit   : {} > FLASH0 | FLASH1
    .pinit   : {} > FLASH0 | FLASH1
    .bss     : {} > RAM
    .data    : {} > RAM
     /* USER CODE BEGIN (3) */
    .sysmem  : {} > SDRAM
    /* USER CODE END */

  
    FEE_TEXT_SECTION : {} > FLASH0 | FLASH1
    FEE_CONST_SECTION : {} > FLASH0 | FLASH1
    FEE_DATA_SECTION : {} > RAM

We created a separate .c file for just the array and we created a scatter.txt file with what was advised below, and we added the --scatter scatter.txt to the linker properties. Will this work or does TI recommend a different approach to mapping variables onto the sdram part on the board??

(copy/paste from arm site)

Mapping variables to specific addresses

Memory mapped registers can be accessed from C in two ways: either by forcing a array or struct variable to a specific address, or by using a pointer to an array or struct (see below for details). Both generate efficient code - it is really down to a matter of personal preference.

  1. Forcing struct/array to a specific address

    The 'variable' should be declared it in a file on its own. When it is compiled, the object code for this file will only contain data. This data can be placed at a specified address using the ARM scatter-loading mechanism. This is the recommended method for placing all AREAs (code, data, etc) at required locations in the memory map.

    1. Create a C source file, for example, iovar.c which contains a declaration of the variable/array/struct, e.g.

      volatile unsigned short u16_IORegs[20];

      or

      struct{
        volatile unsigned reg1;
        volatile unsigned reg2;
      } mem_mapped_reg;
    2. Create a scatter-loading description file (called scatter.txt) containing the following:

      ALL 0x8000
      {
        ALL 0x8000
        {
          * (+RO,+RW,+ZI)
        }
      }
      IO 0x40000000
      {
        IO 0x40000000
        {
          iovar.o (+ZI)
        }
      }

      The scatter-loading description file must be specified at link time to the linker using the --scatter scatter.txt command line option. This creates two different load regions in your image: 'ALL' and 'IO'. The zero-initialised area from iovar.o (containing your array) goes into the IO area located at 0x40000000. All code (RO) and data areas (RW and ZI) from other object files go into the 'ALL' region which starts at 0x8000.

      If you have more than one group of variables (more than one set of memory mapped registers) you would need to define each group of variables as a separate execution region (though they could all lie within a single load region). To do this, each group of variables would need to be defined in a separate module.

      The benefit of using a scatter-loading description file is that all the (target-specific) absolute addresses chosen for your devices, code and data are located in one file, making maintenance easy. Furthermore, if you decide to change your memory map (for example, if peripherals are moved), you do not need to rebuild your entire project - you only need to re-link the existing objects.

      Alternatively, it is possible to use the #pragma arm section pragma to place the data into a specific section and then use scatter-loading to place that data at an explicit location.  For further information, please see the ARM Compiler toolchains Compiler Reference documentation.

  • Hi, Would a simple #pragma DATA_SECTION(g_flashMap, ".sdram") command do if I changed the .cmd file to:

    MEMORY
    {
    VECTORS (X) : origin=0x00000000 length=0x00000020
    FLASH0 (RX) : origin=0x00000020 length=0x0017FFE0
    FLASH1 (RX) : origin=0x00180000 length=0x00180000
    STACKS (RW) : origin=0x08000000 length=0x00000900
    RAM (RW) : origin=0x08000900 length=0x0003f700

    /* USER CODE BEGIN (2) */
    SDRAM (RW) : origin=0x80000000 length=0x00200000
    /* USER CODE END */
    }



    /*----------------------------------------------------------------------------*/
    /* Section Configuration */

    SECTIONS
    {
    .intvecs : {} > VECTORS
    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM

    FEE_TEXT_SECTION : {} > FLASH0 | FLASH1
    FEE_CONST_SECTION : {} > FLASH0 | FLASH1
    FEE_DATA_SECTION : {} > RAM

    /* USER CODE BEGIN (3) */
    .sdram : {} > SDRAM
    /* USER CODE END */
  • Hello Tammy,

    Yes, it should work. Please refer to the "The DATA_SECTION Pragma" section in the Compiler userguid. www.ti.com/.../spnu151l.pdf