SRAM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SRAM

870 Views
gaetanoanania
Contributor III

Hi all,

I am working with TWR K70. I would need to use the external SRAM (ext RAM of the tower) like the internal RAM  to allocate variables without direct addressing.

I mean I want to define a macro (#define XDATA) that allocates the variable in exeternal RAM.

At moment I allocate the variable in a specific address of external RAM


int*test1=(int*)ADDR1;

float*test2=(float*)ADDR2;


where ADDR1 and ADDR2 are calculated before to avoid overwritten.

I want to have the below situation:

(maybe it need previous section define in *.lcf file)

#define ADDRESSING   ...something...

int ADDRESSING test1;

float ADDRESSING test2;

so the variable will be allocated in external RAM "automatically".

Is it possible to do it?

Thanks in advance.

Gae

Labels (1)
2 Replies

544 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Gae,

You need to manipulate the linker file (.lcf if you are using Freescale compiler or .ld if you are using GCC)  to create an external RAM memory segment and a new section where you are going to place the relocated data. The attached document explains how to do this with GCC.

In both cases you need also to use a compiler directive in the source file to tell the compiler which are the variables that are being relocated in external RAM. The document shows how to do this with a function. With variables you can follow the same procedure.

Regards,

Carlos

544 Views
gaetanoanania
Contributor III

Hi Carlos,

thank you. I think your advice will be useful a lot. I 'll let you know .

Gae

0 Kudos