----- Ursprüngliche Nachricht -----
Von: Peter Bigot
Gesendet am: 12 Dez 2011 21:39:15

On Mon, Dec 12, 2011 at 2:31 PM, Timothy Logan <timothy.lo...@gmail.com> wrote:
>> I am porting some code from IAR which involves me having to place a few
>> different structures in very specific addresses in the MSP430 memory.

> You can use asm statements, as are done with the peripheral register
> declarations.  Something like:
> volatile unsigned int specialdata __asm__("0x1320");
> will force the definition of specialdata to be placed at address 0x1320.

That's the obvious way.
However, it must be used with care.
The variable locations are put as direct addresses into the
compiler-generated assembly output.
The linker won't see them or know of them.

So if two independent compilaiton units (C files)
Use their own "superstatic variable" and it happens
to be placed on the same location, you won't get
an error or even a warning. And the two code parts
will mess with each others storage then.

Especially dangerous when using libraries, where
the particular code is not checked/adjusted for every project.
(so it could be noticed)

JMGross

------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and 
improve service delivery. Take 5 minutes to use this Systems Optimization 
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to