[En-Nut-Discussion] Table driven routines (was Re: Using boost::preprocessor (preprocessor metaprogramming))

duane ellis ethernut at duaneellis.com
Fri Feb 13 19:24:57 CET 2009


Harald> There is one unique feature of the AVR, which you may not be 
aware of.
Harald>   [the AVR has special bit instructions]

Ahh, yes, that would make lots of sense, and explains many things. I 
certainly did not know that.

The 8051 has things like that, see below.

Question: Is this target an 'AVR32'- or an 'AVR8/16' - I thought it was 
a 32bit, in which case, I doubt there are special instructions to access 
peripherals [again, I don't know the AVR seriels as well as you]

With 8051, there is "xdata", "code" and "data" memory spaces, and 
"generic pointers", and SFRs (special function registers), a normal 
pointer is 2 bytes, a generic pointer is 3 bytes, the 3rd byte is a type 
code. However, one _can_  specifically place an attribute on a pointer, 
and remove that 3rd byte. In Old "8086" days, it was "_near" and "_far" 
and the ":>" funny pointer construct that MS Compilers supported that 
let you mix things. Today, we use "const" and "volatile" in the same ways.

To be honest, I don't know the AVR as well as you, I also do not know 
the various compiler options.

I wonder if there is a similar special "attribute" that can be specified 
in this sort of situation, you might check.

For example:

     typedef  _sfr_reg *SFR_REG_POINTER;

Might create an "SFR REGISTER POINTER" type.

Maybe, that type of thing just will not work on the AVR I don't know.

-Duane.



More information about the En-Nut-Discussion mailing list