[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] sfr_defs.h: _SFR_IO_REG_P(SMPCR)

From: E. Weddington
Subject: Re: [avr-gcc-list] sfr_defs.h: _SFR_IO_REG_P(SMPCR)
Date: Fri, 30 Aug 2002 11:31:22 -0600

On 29 Aug 2002 at 17:00, Theodore A. Roth wrote:
> <code snippet>
> What I suspect is happening is that the #if parts don't like the casts
> in the macros. The casts are thrown in when compiling a C program
> (!_SFR_ASM_COMPAT) and don't go through the preprocessor for asm
> Is there some compelling reason you need to use the preprocessor? Can
> you just use "_SFR_ADDR(SPMCR)" instead and let the compiler figure
> what code to generate?
> From sfr_defs.h:
> "In C programs, all 3 combinations of _SFR_ASM_COMPAT and __SFR_OFFSET
> are supported - the _SFR_ADDR(SPMCR) macro can be used to get the
> address of the SPMCR register (0x57 or 0x68 depending on device)."

I *think* I can get away without using the preprocessor... based on 
other stuff Marek said in sfr_defs.h:

"If you do not define __SFR_OFFSET (so it will be 0x20 by default), 
all special register addresses are defined as memory addresses (so 
SREG is 0x5f), and (if code size and speed are not important, and you 
don't like the ugly #if above) you can always use lds/sts to access 

The crux has to do with switching between sts and out instructions in 
some inline assembly. But I'll probably just forego that and always 
use sts.

Thanks for your help. :-)


avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]