Porting code to gcc, replacement for SFR?

Alan Mimms alan@packetengines.com
Fri Nov 7 09:19:00 GMT 1997


Wouldn't something like

  #define FUNKYREG (*(volatile unsigned long *) 0x12345678)

serve?

This is to define a name for a register memory mapped to 0x12345678 that
is 32 bits wide.  Of course you can use short or char if you need to.

Why do you need anything more?  If the target architecture requires
special instructions to access the register you can use the "asm ()"
construct.

a

> -----Original Message-----
> From:	Roy Leonard [SMTP:rleonard@trintech.com]
> Sent:	Friday, November 07, 1997 3:55 AM
> To:	James Youngman; crossgcc@cygnus.com
> Subject:	Re: Porting code to gcc, replacement for SFR?
> 
> 
> 
> If I understand "The Explicit reg vars" correctly, this allows you to
> access
> the internal registers which are addressed by name in assembler, eg.
> r1.  If
> I understand this correctly, it doesn't allow you to specify a memory
> mapped
> register.  Is this correct? If this allows you to specify a memory
> mapped
> register, how do I implement it?
> 
> Cheers,
> 
> Roy
> 
> ...
> >  Roy> The code makes use of an IAR specific type called sfr -
> special function
> >  Roy> register.  Does anyone know of a similar type in gcc, or an
> easy way to
> >  Roy> implement a similar type?
> >
> >  Roy> A special function register is something like a UART control
> register, which
> >  Roy> is at a predetermined address and can read/written to as a
> byte or as
> >  Roy> individual bits.
> >
> >GCC allows you to specify for a variable what machine register it
> >should live in,  I expect that that will do what you want.  The
> >relevant technique is explained in the GCC documentation.   The info
> >nnode you want is titled "Explicit Reg Vars".
> >
> >
> Roy Leonard
> Trintech Manufacturing Ltd
> Tel: +353 1 295 6766
> Fax: +353 1 295 4735
> aka: <leonardr@iol.ie>
> "Never Attribute to Malice that which can be adequately explained by
> stupidity!"



More information about the crossgcc mailing list