On Thu, Nov 25, 2010 at 6:28 AM, JMGross <[email protected]> wrote:
>
> 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)
>
Why not? That's the planned approach for uniarch, where the declaration for
P1IN would reference global symbol __P1IN which is resolved at the
non-relocatable link stage. This reduces the number of libraries required
by allowing chips that have the same register definitions, but at different
addresses, to share an implementation. It also reduces (does not eliminate)
the likelihood of errors from separate compilation with different header
files.
Peter
>
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users