198
ATmega8A [DATASHEET]
8159E–AVR–02/2013
24.6
Entering the Boot Loader Program
Entering the Boot Loader takes place by a jump or call from the application program. This may be initiated by a trig-
ger such as a command received via USART, or SPI interface. Alternatively, the Boot Reset Fuse can be
programmed so that the Reset Vector is pointing to the Boot Flash start address after a reset. In this case, the Boot
Loader is started after a reset. After the application code is loaded, the program can start executing the application
code. Note that the fuses cannot be changed by the MCU itself. This means that once the Boot Reset Fuse is pro-
grammed, the Reset Vector will always point to the Boot Loader Reset and the fuse can only be changed through
the serial or parallel programming interface.
Note:
1. “1” means unprogrammed, “0” means programmed
24.7
Addressing the Flash During Self-Programming
The Z-pointer is used to address the SPM commands.
ing two different sections. One section, consisting of the least significant bits, is addressing the words within a
page, while the most significant bits are addressing the pages. This is shown in
Figure 24-3. Note that the page
erase and page write operations are addressed independently. Therefore it is of major importance that the Boot
Loader software addresses the same page in both the page erase and page write operation. Once a programming
operation is initiated, the address is latched and the Z-pointer can be used for other operations.
The only SPM operation that does not use the Z-pointer is Setting the Boot Loader Lock Bits. The content of the Z-
pointer is ignored and will have no effect on the operation. The LPM instruction does also use the Z-pointer to store
the address. Since this instruction addresses the Flash byte by byte, also the LSB (bit Z0) of the Z-pointer is used.
Table 24-4.
Boot Reset Fuse
BOOTRST
Reset Address
1
Reset Vector = Application Reset (address 0x0000)
0
Bit
151413121110
9
8
ZH (R31)
Z15
Z14
Z13
Z12
Z11
Z10
Z9
Z8
ZL (R30)
Z7Z6Z5Z4Z3Z2Z1Z0
7
6543210