Skip to main content
dps
Associate
Feb 5, 2009 4:45 AM UTC
Question

variables in external SRAM

Posted on February 05, 2009 at 05:45

variables in external SRAM

    This topic has been closed for replies.

    4 replies

    dps
    dpsAuthor
    Associate
    May 17, 2011 11:01 AM UTC
    Posted on May 17, 2011 at 13:01

    Hallo,

    I am new user of KEIL MDK tool with ma MCBSTM32E (STM32F103 device) board from KEIL.

    My variables in main.c are located in on-chip RAM. But some variables

    i want to locate to external SRAM memory mounted on board.

    How is syntax to declare (define) this type of variables. In Keil C51 it was XDATA.

    Thank you very much and sorry for my poor English.

    [ This message was edited by: dps on 31-01-2009 18:09 ]

    st3
    Associate III
    May 17, 2011 11:01 AM UTC
    Posted on May 17, 2011 at 13:01

    Quote:

    I am new user of KEIL MDK tool with ma MCBSTM32E (STM32F103 device) board from KEIL.

    Doesn't the kit come with examples to use its off-chip SRAM?

    Quote:

    In Keil C51 it was XDATA.

    No, that's not true.

    Using XDATA simply tells the compiler to use MOVX instructions to address the variables - it does not specify whether the memory is on-chip or off-chip.

    To force it into off-chip XDATA, you would have to know the address range of the off-chip XRAM, and use Linker directives to specify an off-chip address.

    You should look at a similar approach here...

    [ This message was edited by: st7 on 05-02-2009 10:16 ]

    lonnie
    Associate III
    May 17, 2011 11:01 AM UTC
    Posted on May 17, 2011 at 13:01

    You should be able to define a section in your .c file. In your .icf file define a region that resides in your external SRAM (0x68000000 - 0x68??????).

    Place the section that you define in your .c file in the external SRAM region you just defined. You can now place the variables that you need inside of the section.

    You will have to refer to your compiler and linker documentation for how to define a section and region.

    [ This message was edited by: lonnie.walker on 05-02-2009 15:14 ]

    jki79ros81
    Associate III
    May 17, 2011 11:01 AM UTC
    Posted on May 17, 2011 at 13:01

    In my opinion,you have to make new .c file(extvar.c) and define variables in this file.

    You see, in project workspace of keil, select extvar.c and open option window , select your external SRAM in the memory assignment.

    Hope your success.