Hi,

why not do as the libraries declare and define SFRs?

In the header use

extern __at(0x0400) volatile BDT ep0_o;

In one .c file use

__at(0x0400) volatile BDT ep0_o;

The relative order of __at() and the other keywords is somewhat flexible, the above scheme is used in the device libraries and headers.

Hope that helps,
Raphael

On Jun 21, 2014 10:35 PM, "Kustaa Nyholm" <Kustaa.Nyholm@planmeca.com> wrote:
On 18/06/2014 16:41, "Maarten Brock" <sourceforge.brock@dse.nl> wrote:
>
>I don't know. I don't work on the pic backend. But try it and you'll find
>out soon enough I guess by looking at the generated asm.

Maybe I should have tried this first...


In the .h I put:

extern volatile BDT ep0_o;


In the .c that includes above I put:

volatile BDT __at (0x0400+0*8) ep0_o;

and the compiler says:

usb_pic_defs.c:9: error 91: extern definition for 'ep0_o' mismatches with
declaration.
usb_pic_defs.h:70: error 177: previously defined here


So...maybe I'm too tired but I can't figure out how I can put a
variable at a given address and declare it in the .h file
and define it in the .c file. If I define it at the .h file
then I get into trouble with linker if I include the .h file
in multiple .c files...not god.

br Kusti







This e-mail may contain confidential or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. We will not be liable for direct, indirect, special or consequential damages arising from alteration of the contents of this message by a third party or as a result of any virus being passed on or as of transmission of this e-mail in general.

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user