Introduction the fuse api allows a user to specify the fuse settings for the specific avr device they are compiling for. these fuse settings will be placed in a special section in the elf output file, after linking. programming tools can take advantage of the fuse information embedded in the elf file, by extracting this information and determining if the fuses need to be programmed before programming the flash and eeprom memories. this also allows a single elf file to contain all the information needed to program an avr. to use the fuse api, include the avr/io.h header file, which in turn automatically includes the individual i/o header file and the avr/fuse.h file. these other two files provides everything necessary to set the avr fuses. fuse api each i/o header file must define the fuse_memory_size macro which is defined to the number of fuse bytes that exist in the avr device. a new type, __fuse_t, is defined as a structure. the number of fields in this structure are determined by the number of fuse bytes in the fuse_memory_size macro. if fuse_memory_size == 1, there is only a single field: byte, of type unsigned char. if fuse_memory_size == 2, there are two fields: low, and high, of type unsigned char. if fuse_memory_size == 3, there are three fields: low, high, and extended, of type unsigned char. if fuse_memory_size 3, there is a single field: byte, which is an array of unsigned char with the size of the array being fuse_memory_size. a convenience macro, fusemem, is defined as a gcc attribute for a custom-named section of '.fuse'. a convenience macro, fuses, is defined that declares a variable, __fuse, of type __fuse_t with the attribute defined by fusemem. this variable allows the end user to easily set the fuse data. note: if a device-specific i/o header file has previously defined fusemem, then fusemem is not redefined. if a device-specific i/o header file has previously defined fuses, then fuses is not redefined. each avr device i/o header file has a set of defined macros which specify the actual fuse bits available on that device. the avr fuses have inverted values, logical 1 for an unprogrammed (disabled) bit and logical 0 for a programmed (enabled) bit. the defined macros for each individual fuse bit represent this in their definition by a bit-wise inversion of a mask. for example, the fuse_eesave fuse in the atmega128 is defined as:
Generated automatically by Doxygen for avr-libc from the source code.