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.

RM48L950: place external sram, a static object initialise failed.

Part Number: RM48L950

Hi,
In my project, the hardware platform CPU is RM48L950, the software development platform is IAR. I use the RM48L950's EMIF interface to external expand SRAM which has an address space of 2MB, 8Bit data bus . I want to run the program on this SRAM. So, in sys_startup.c, in the void _c_int00 (void) function, increase _mpuInit_ () and _mpuEnable_ () function above the _coreInitRegisters_ () function, increase SRAM initialization function SramInit() above the __cmain() function. as follows:
void _c_int00(void)
{

/* USER CODE BEGIN (5) */
/* USER CODE END */
_mpuInit_();
_mpuEnable_();

/* Initialize Core Registers to avoid CCM Error */
_coreInitRegisters_();

......

esmInit();
/* USER CODE BEGIN (75) */
SramInit();
/* USER CODE END */

/* call the application */
__cmain();
}

I declare a static object initialised with a pattern, place it in the SRAM. code follows:
static unsigned int myinittest[ 2 ] =
{
0x01234567,
0x89abcdef
}
However, when the target file is downloaded to the board, myinittest array is not correctly initialized. the initialization result:
myinittest[0] = 0x23456700
myinittest[1] = 0xabcdef00

Can you tell me why? I need your help.
Best regards.

  • So the problem is likely this:

    a) you are asking the compiler to automatically initialize your array myinittest[] that is located in RAM on the EMIF
    b) the compiler doesn't know that the EMIF hardware must be configured by calling SramInit(); prior to initializing myinittest[].

    There should be some call to the code that the compiler runtime library uses to copy auto-init variables from flash to SRAM.
    You probably need to move SramInit() to before this code from the compiler is called.