4 boot loader lock bits, 1 entering the boot loader program, 5 addressing the flash during self-programming – Rainbow Electronics ATmega128RFA1 User Manual
Page 453: Atmega128rfa1

453
8266A-MCU Wireless-12/09
ATmega128RFA1
30.4 Boot Loader Lock Bits
If no Boot Loader capability is needed, the entire Flash is available for application code.
The Boot Loader has two separate sets of Boot Lock bits which can be set
independently. This gives the user a unique flexibility to select different levels of
protection.
The user can select:
•
To protect the entire Flash from a software update by the MCU.
•
To protect only the Boot Loader Flash section from a software update by the MCU.
•
To protect only the Application Flash section from a software update by the MCU.
•
Allow software update in the entire Flash.
for further details. The Boot Lock bits can be set in
software and in Serial or Parallel Programming mode, but they can be cleared by a
Chip Erase command only. The general Write Lock (Lock Bit mode 2) does not control
the programming of the Flash memory by SPM instruction. Similarly, the general
Read/Write Lock (Lock Bit mode 1) does not control reading nor writing by
(E)LPM/SPM, if it is attempted.
30.4.1 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 trigger 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 programmed, 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.
Table 30-2. Boot Reset Fuse
(1)
BOOTRST
Reset Address
1
Reset Vector = Application Reset (address 0x0000)
0
Reset Vector = Boot Loader Reset (see
Note:
1. “1” means unprogrammed, “0” means programmed
30.5 Addressing the Flash During Self-Programming
The Z-pointer is used to address the SPM commands. The Z pointer consists of the Z-
registers ZL and ZH in the register file, and RAMPZ in the I/O space. The number of
bits actually used is implementation dependent. Note that the RAMPZ register is only
implemented when the program space is larger than 64K bytes.
23
22
21
20
19
18
17
16
Bit
15
14
13
12
11
10
9
8
RAMPZ
RAMPZ1 RAMPZ0
ZH (R31)
Z15
Z14
Z13
Z12
Z11
Z10
Z9
Z8
ZL (R30)
Z7
Z6
Z5
Z4
Z3
Z2
Z1
Z0
7
6
5
4
3
2
1
0