Datasheet
328
2549O–AVR–05/12
ATmega640/1280/1281/2560/2561
; return to RWW section
; verify that RWW section is safe to read
Return:
in temp1, SPMCSR
sbrs temp1, RWWSB ; If RWWSB is set, the RWW section is not ready yet
ret
; re-enable the RWW section
ldi spmcrval, (1<<RWWSRE) | (1<<SPMEN)
call Do_spm
rjmp Return
Do_spm:
; check for previous SPM complete
Wait_spm:
in temp1, SPMCSR
sbrc temp1, SPMEN
rjmp Wait_spm
; input: spmcrval determines SPM action
; disable interrupts if enabled, store status
in temp2, SREG
cli
; check that no EEPROM write access is present
Wait_ee:
sbic EECR, EEPE
rjmp Wait_ee
; SPM timed sequence
out SPMCSR, spmcrval
spm
; restore SREG (to enable interrupts if originally enabled)
out SREG, temp2
ret
29.6.14 ATmega640 Boot Loader Parameters
In Table 29-7 through Table 29-9 on page 329, the parameters used in the description of the
Self-Programming are given.
Note: 1. The different BOOTSZ Fuse configurations are shown in Figure 29-2 on page 320.
Table 29-7. Boot Size Configuration, ATmega640
(1)
BOOTSZ1
BOOTSZ0
Boot Size
Pages
Appli-cation
Flash Section
Boot Loader
Flash Section
End Application
Section
Boot Reset
Address
(Start Boot
Loader Section)
11
512
words
4
0x0000 -
0x7DFF
0x7E00 -
0x7FFF
0x7DFF 0x7E00
10
1024
words
8
0x0000 -
0x7BFF
0x7C00 -
0x7FFF
0x7BFF 0x7C00
01
2048
words
16
0x0000 -
0x77FF
0x7800 -
0x7FFF
0x77FF 0x7800
00
4096
words
32
0x0000 -
0x6FFF
0x7000 -
0x7FFF
0x6FFF 0x7000