
CHAPTER 26 FLASH MEMORY
User’s Manual U17260EJ6V0UD
588
26.10 Flash Memory Programming by Self-Programming
The 78K0/KE2 supports a self-programming function that can be used to rewrite the flash memory via a user
program.
Because this function allows a user application to rewrite the flash memory by using a self-programming
library, it can be used to upgrade the program in the field.
If an interrupt occurs during self-programming, self-programming can be temporarily stopped and interrupt
servicing can be executed. To execute interrupt servicing, restore the normal operation mode after self-programming
has been stopped, and execute the EI instruction.
After the self-programming mode is later restored, self-
programming can be resumed.
Remark
For details of the self-programming function and the self-programming library, refer to 78K0/Kx2 Flash
Memory Self Programming User’s Manual (U17516E).
Cautions 1. The self-programming function cannot be used when the CPU operates with the subsystem
clock.
2. Input a high level to the FLMD0 pin during self-programming.
3. Be sure to execute the DI instruction before starting self-programming.
The self-programming function checks the interrupt request flags (IF0L, IF0H, IF1L, and IF1H).
If an interrupt request is generated, self-programming is stopped.
4. Self-programming is also stopped by an interrupt request that is not masked even in the DI
status. To prevent this, mask the interrupt by using the interrupt mask flag registers (MK0L,
MK0H, MK1L, and MK1H).
5. Allocate the entry program for self-programming in the common area of 0000H to 7FFFH.
Figure 26-15. Operation Mode and Memory Map for Self-Programming (
PD78F0537)
Memory bank 1
Memory bank 4
Memory bank 3
Memory bank 5
Memory bank 2
Normal mode
Flash memory
(common area)
0000H
8000H
7FFFH
FFFFH
FB00H
F A FFH
C000H
BFFFH
F800H
F7FFH
E000H
DFFFH
FF00H
FEFFH
Internal high-
speed RAM
Internal
expansion RAM
SFR
Reserved
Flash memory
control
firmware ROM
Disable
accessing
Flash memory
(memory bank 0)
Memory bank 1
Memory bank 4
Memory bank 3
Memory bank 5
Memory bank 2
Self-programming mode
Flash memory
(common area)
0000H
8000H
7FFFH
FFFFH
FB00H
F AFFH
F A 20H
F A 1FH
F A 20H
FA 1 F H
C000H
BFFFH
F800H
F7FFH
F A 00H
F9FFH
F A 00H
F9FFH
E000H
DFFFH
FF00H
FEFFH
Internal high-
speed RAM
Internal
expansion RAM
SFR
Reserved
Buffer RAM
Reserved
Flash memory
control
firmware ROM
Disable
accessing
Enable
accessing
Instructions can be fetched
from common area and
selected memory bank.
Instructions can be
fetched from common
area and firmware ROM.