This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32 SDRAM Scatter File

Hello,

i have the following problem:

I would like to access the external SDRAM on the STM32F429 Discovery. I could access the external SDRAM, that is not the main problem. The problem is, that i have to access the external SDRAM as the following:

 /* SDRAM Initialization */
  SDRAM_Init();

  /* FMC SDRAM GPIOs Configuration */
  SDRAM_GPIOConfig();

//Write SDRAM
  for (counter = 0; counter < TRANSFERS; counter++)
  {
    *(__IO uint16_t*) (SDRAM_BANK_ADDR + 2*counter) = (uint16_t)(uhWritedata_16b + counter);
  }

Here i havé to add the Address "SDRAM_BANK_ADDR" if i would like to write into the external SDRAM. Now i should configure the Scatter - File that i doesn't need that Section. How must be the changes? Is it possible to auto - configure this Section as external SDRAM?

My Scatter File looks like this:


; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x08000000 0x00200000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00200000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  RW_IRAM1 0x20000000 0x00030000  {  ; RW data
   .ANY (+RW +ZI)
  }
}


;LR_ERAM1 0xD0000000 0xD0400000 {
        ;ER_ERAM1 0xD0000000 0xD0400000  {
          ;.ANY (+RW +ZI)
        ;}
;}



Thanks for your help.

Parents
  • Hello Clive,

    i did the following changes. I changed the value from the HEAP_SIZE to more or less 4MB. My Map-File looks now like the following, it's only a piece from it:

    //Buf is the Variable which should be located in SDRAM -> The Adress 0xd000... is correct
    buf                               0xd0000000   Data         256  system_stm32f4xx.o(.sdram)
    
    
    Execution Region RW_IRAM2 (Base: 0xd0000000, Size: 0x00400000, Max: 0x00400000, ABSOLUTE)
    
    Base Addr    Size         Type   Attr      Idx    E Section Name        Object
    
    0xd0000000   0x00000100   Data   RW         3019    .sdram              system_stm32f4xx.o
    0xd0000100   0x003fff00   Zero   RW            2    HEAP         startup_stm32f429_439xx.o
    

    Now Im trying to debug the Project step by step to try to understand the problems like you told me. Im started by the startup file and then i go through the SystemInit Function called in the Startup - File / everything works fine. In this function is the ExtMem_Ctl() called. When im debugging there step by step, the error occures in the following line:

    FMX_Bank5_6->SDCR[0] = 0x000029D0
    

    The Error which occures is: Cannot access target. Shutting down debug session.

Reply
  • Hello Clive,

    i did the following changes. I changed the value from the HEAP_SIZE to more or less 4MB. My Map-File looks now like the following, it's only a piece from it:

    //Buf is the Variable which should be located in SDRAM -> The Adress 0xd000... is correct
    buf                               0xd0000000   Data         256  system_stm32f4xx.o(.sdram)
    
    
    Execution Region RW_IRAM2 (Base: 0xd0000000, Size: 0x00400000, Max: 0x00400000, ABSOLUTE)
    
    Base Addr    Size         Type   Attr      Idx    E Section Name        Object
    
    0xd0000000   0x00000100   Data   RW         3019    .sdram              system_stm32f4xx.o
    0xd0000100   0x003fff00   Zero   RW            2    HEAP         startup_stm32f429_439xx.o
    

    Now Im trying to debug the Project step by step to try to understand the problems like you told me. Im started by the startup file and then i go through the SystemInit Function called in the Startup - File / everything works fine. In this function is the ExtMem_Ctl() called. When im debugging there step by step, the error occures in the following line:

    FMX_Bank5_6->SDCR[0] = 0x000029D0
    

    The Error which occures is: Cannot access target. Shutting down debug session.

Children