Ed Proulx

declare ram variable at fixed known address

Discussion created by Ed Proulx on Dec 29, 2009
Latest reply on Nov 8, 2011 by Madhu Bhaskar Surisetty

There is a decent amount of information on how to declare a variable in ram at a fixewd known address - but none is concise or complete.


On my MC52259 board (64K ram), I wanted a ram var at say: 0x20000400. It is 0x20 bytes long. I modeled the declaration after similar variables in flash, I get what I want, except the linker fails as the "next var" (as per the lcf linker control file) must be on a 512-byte boundary. So I'd wasting ram unless I put in code for specific use of wha's left in that area.


Is there a way to have a small variable of 0x20 bytes at a specified, well-known address without the boundary issue?


I assume that I'll have some sort of declaration in the .lcf file, and a #pragma in my main.c module.