1 rww - read-while-write section – Rainbow Electronics ATmega128RFA1 User Manual
Page 451

451
8266A-MCU Wireless-12/09
ATmega128RFA1
30.3 Read-While-Write and No Read-While-Write Flash Sections
Whether the CPU supports Read-While-Write or if the CPU is halted during a Boot
Loader software update is dependent on the address that is being programmed. In
addition to the two sections that are configurable by the BOOTSZ Fuses as described
above, the Flash is also divided into two fixed sections, the Read-While-Write (RWW)
section and the No Read-While-Write (NRWW) section. The limit between the RWW-
and NRWW sections is given in
. The
main differences between the two sections are:
•
When erasing or writing a page located inside the RWW section, the NRWW section
can be read during the operation.
•
When erasing or writing a page located inside the NRWW section, the CPU is halted
during the entire operation.
Note that the user software can never read any code that is located inside the RWW
section during a Boot Loader software operation. The syntax “Read-While-Write
section” refers to the section that is being programmed (erased or written) and not to
the section that actually is being read during a Boot Loader software update.
Figure 30-1. Read-While-Write vs. No Read-While-Write
Read-While-Write
(RWW) Section
No Read-While-Write
(NRWW) Section
Z-pointer
Addresses RWW
Section
Z-pointer
Addresses NRWW
Section
CPU is Halted
During the Operation
Code Located in
NRWW Section
Can be Read During
the Operation
30.3.1 RWW – Read-While-Write Section
If a Boot Loader software update is programming a page inside the RWW section, it is
possible to read code from the Flash, but only code that is located in the NRWW
section. During an ongoing programming, the software must ensure that the RWW
section never is being read. If the user software is trying to read code that is located
inside the RWW section (i.e., by load program memory, call, or jump instructions or an
interrupt) during programming, the software might end up in an unknown state. To avoid
this, the interrupts should either be disabled or moved to the Boot Loader section. The
Boot Loader section is always located in the NRWW section. The RWW Section Busy
bit (RWWSB) in the Store Program Memory Control and Status Register (SPMCSR) will
be read as logical one as long as the RWW section is blocked for reading. After a