avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] SPMEN, SELFPRGEN: name clash


From: Ivan Shmakov
Subject: [avr-libc-dev] SPMEN, SELFPRGEN: name clash
Date: Sun, 30 Dec 2007 00:43:17 +0600
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

        There's apparently a name clash between the SPMEN / SELFPRGEN
        fuse bit and the eponymous bit of the SPMCSR register.
        Consider, e. g.:

$ nl -ba include/avr/iotn13.h 
...
    33  /* avr/iotn13.h - definitions for ATtiny13 */
...
   239  /* Store Program Memory Control and Status Register */
   240  #define SPMCSR               _SFR_IO8(0x37)
   241  #  define CTPB                 4
   242  #  define RFLB                 3
   243  #  define PGWRT                2
   244  #  define PGERS                1
   245  #  define SPMEN                0
   246  #  define SELFPRGEN            0
...
   344  /* High Fuse Byte */
   345  #define RSTDISBL    ~_BV(0)
   346  #define BODLEVEL0   ~_BV(1)
   347  #define BODLEVEL1   ~_BV(2)
   348  #define DWEN        ~_BV(3)
   349  #define SPMEN       ~_BV(4)
   350  #define HFUSE_DEFAULT (0xFF)
...
$ 

        (And $ grep -lF SELFPRGEN appears to catch a few more cases.)

        Unfortunately, it seems to be the official name for these two
        bits (as of ATtiny13 datasheet [1].)

        I guess, one of the macros needs to be assigned a different
        name.  Perhaps, a specific prefix should be added to all the
        fuse bits, so that the conflicts like this one won't be possible
        in the future.

        BTW, since SPMEN seems to be frequent alias to SELFPRGEN, why
        not to define one of them in a common file (`io.h'?) instead of
        defining both in each of the part-specific headers (where
        applicable)?  E. g.:

#if defined (SPMEN) && ! defined (SELFPRGEN)
#  define SELFPRGEN SPMEN
#endif

[1] http://www.atmel.com/dyn/resources/prod_documents/doc2535.pdf

PS.  Thanks for avr-libc.  I've ported a rather simple program for
        ATtiny13 from assembler to C recently and was pleased to see
        that it works quite well.





reply via email to

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