cancel
Showing results for 
Search instead for 
Did you mean: 

variables in external SRAM

dps
Associate II
Posted on February 05, 2009 at 05:45

variables in external SRAM

4 REPLIES 4
dps
Associate II
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 ]

jki79ros81
Associate II
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.

lonnie
Associate II
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 ]

st3
Associate II
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 ]