The ASM directive is used for defining all the hardware registers as 
'variables'. Since teh header files are included into every compilation, all 
modules know of the variables' memory location and access it the same way.
You should consider creating a global or project specific header file with the 
variable declarations and including it everywhere you use them, rather than 
using extern declarations.

Since variables declared with the asm directive cannot be initialized, none of 
the modules reading these declarations will generate an instance of this 
variable, so no global identifier is exported. But since the directive 
causes the variabel name replaced by the asm reference, the name is not 
referenced too, so thsi variable simply exists and is accessed, but never 
referenced by a symbol. (well, in theory, the ASM reference may be a 
global assembly symbol instead of a number, but that wouldn't be of any use) 

JMGross

----- Ursprüngliche Nachricht -----
Von: Mark J. Blair
An: mspgcc-users
Gesendet am: 21 Nov 2010 00:40:50
Betreff: Re: [Mspgcc-users] __no_init equivalent?


On Nov 20, 2010, at 3:32 PM, Chris Liechti wrote:
> http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Asm-Labels.html#Asm-Labels

Aha! So, when the directive is used in this way, it's telling the 
compiler+assembler to simply cram the numeric constant in place of the symbol 
name? This would also explain why I'm getting undefined 
reference errors now from another module which references the USB-RAM-resident 
structures. I'm learning lots of stuff here, but I still have more 
experimentation ahead of me to find a nice, clean way to 
port this particular code. Maybe I'm better off just treating them as externs 
in the C code, and defining the symbols for linkage purposes in an assembler 
code file.


------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to