|AVR Libc Home Page||AVR Libc Development Pages|
|Main Page||User Manual||Library Reference||FAQ||Alphabetical Index||Example Projects|
|#define||BOOTLOADER_SECTION __attribute__ ((section (".bootloader")))|
|#define||boot_spm_interrupt_enable() (__SPM_REG |= (uint8_t)_BV(SPMIE))|
|#define||boot_spm_interrupt_disable() (__SPM_REG &= (uint8_t)~_BV(SPMIE))|
|#define||boot_is_spm_interrupt() (__SPM_REG & (uint8_t)_BV(SPMIE))|
|#define||boot_rww_busy() (__SPM_REG & (uint8_t)_BV(__COMMON_ASB))|
|#define||boot_spm_busy() (__SPM_REG & (uint8_t)_BV(__SPM_ENABLE))|
|#define||boot_page_fill(address, data) __boot_page_fill_normal(address, data)|
The macros in this module provide a C language interface to the bootloader support functionality of certain AVR processors. These macros are designed to work with all sizes of flash memory.
Global interrupts are not automatically disabled for these macros. It is left up to the programmer to do this. See the code example below. Also see the processor datasheet for caveats on having global interrupts enabled during writing of the Flash.
Check if the SPM interrupt is enabled.
Set the bootloader lock bits.
|lock_bits||A mask of which Boot Loader Lock Bits to set.|
For example, to disallow the SPM instruction from writing to the Boot Loader memory section of flash, you would use this macro as such:
Same as boot_lock_bits_set() except waits for eeprom and spm operations to complete before setting the lock bits.
Read the lock or fuse bits at
address can be any of GET_LOW_FUSE_BITS, GET_LOCK_BITS, GET_EXTENDED_FUSE_BITS, or GET_HIGH_FUSE_BITS.
Erase the flash page that contains address.
Same as boot_page_erase() except it waits for eeprom and spm operations to complete before erasing the page.
Fill the bootloader temporary page buffer for flash address with data word.
Same as boot_page_fill() except it waits for eeprom and spm operations to complete before filling the page.
Write the bootloader temporary page buffer to flash page that contains address.
Same as boot_page_write() except it waits for eeprom and spm operations to complete before writing the page.
Check if the RWW section is busy.
Enable the Read-While-Write memory section.
Same as boot_rww_enable() except waits for eeprom and spm operations to complete before enabling the RWW mameory.
Read the Signature Row byte at
address. For some MCU types, this function can also retrieve the factory-stored oscillator calibration bytes.
address can be 0-0x1f as documented by the datasheet.
Check if the SPM instruction is busy.
Wait while the SPM instruction is busy.
Disable the SPM interrupt.
|#define BOOTLOADER_SECTION __attribute__ ((section (".bootloader")))|
Used to declare a function or variable to be placed into a new section called .bootloader. This section and its contents can then be relocated to any address (such as the bootloader NRWW area) at link-time.
|#define GET_EXTENDED_FUSE_BITS (0x0002)|
address to read the extended fuse bits, using boot_lock_fuse_bits_get
|#define GET_HIGH_FUSE_BITS (0x0003)|
address to read the high fuse bits, using boot_lock_fuse_bits_get
|#define GET_LOCK_BITS (0x0001)|
address to read the lock bits, using boot_lock_fuse_bits_get
|#define GET_LOW_FUSE_BITS (0x0000)|
address to read the low fuse bits, using boot_lock_fuse_bits_get