tmp89fm42k TOSHIBA Semiconductor CORPORATION, tmp89fm42k Datasheet - Page 352

no-image

tmp89fm42k

Manufacturer Part Number
tmp89fm42k
Description
8 Bit Microcontroller Tlcs-870/c1 Series
Manufacturer
TOSHIBA Semiconductor CORPORATION
Datasheet
21.5
Access to the Flash Memory Area
RA006
21.5.2.2
perform an erase and a write on the flash memory by using a support program (API) of BOOTROM in MCU
mode. For details, please refere to "21.6 API (Application Programming Interface)".
main section code abs = 0xF000
; #### Transfer the program to RAM ####
sRAMLOOP:
; #### Set a nonmaskable interrupt vector inside the RAM area ####
; #### Allocate RAM to the code area. Switch the vector area to RAM ####
Example: Case in which a sector erase is performed on 0xE000 through 0xEFFF in the data area, and then data at
TMP89FM42K has following support program (API) inside BOOTROM. The following shows how to
Steps 1 through 16 shown below concern the control by a program in the flash memory.
How to write to the flash memory by using a support program (API) of BOOTROM
1. Transfer the subroutine program of nonmaskable interrupt (INTSWI, INTWDT) to RAM.
2. Establish the nonmaskable interrupt vector in the RAM area.
3. After setting both SYSCR3<RAREA> and SYSCR3<RVCTR> to "1", set "0xD4" on SYSCR4.
4. Set "0xD5" on FLSCR2<CR1EN> after setting FLSCR1<BAREA> to "1".
5. Set the erasing address range to A register. For example, to erase sector area from 0xE000 through
6. Set "0xD5" to C register as enable code.
7. Call address (0x1012). (Sector erase is performed. It is not necessary from 2 through 4 steps, if
8. Set "0x00" to C register.
9. Set A[15:0] of address for programing to WA register.
10. Set programing data to E register.
11. Set "0xD5" to (SP-) as enable code.
12. Call address (0x1010). (Byte program is performed)
13. If programing is continued for other address, return to step 8.
14. Set "0xD5" to FLSCR2 after setting FLSCR1<BAREA> to "0".
15. Set "0xD4" to SYSCR4 after setting SYSCR3<RAREA, RVCTR> to "0".
Then allocate RAM to the code area, and switch the vector area to the RAM area.
0xEFFF, set 0x0E to register.To erase sector area from 0x1F000 through 0x1FFFF, set 0x1F to
register.
programing area is already erased beforehand.)
0x0100 through 0x01FF is written to 0xE000 through 0xE0FF in the data area.
If nonmaskable interrupts (INTSWI, INTUNDEF or INTWDT) occur, system clock reset is generated.
.BTWrite
.BTEraseSec
.BTEraseChip equ 0x1014
.BTGetRP
.BTSetRP
cRAMStartAdd equ 0x0200
LD
LD
LD
LD
INC
INC
CMP
J
LD
LDW
LD
LDW
equ 0x1010
equ 0x1012
equ 0x1016
equ 0x1018
HL,cRAMStartAdd
IX,sRAMprogStart
A,(IX)
(HL),A
HL
IX
IX,sRAMprogEnd
NZ,sRAMLOOP
HL,0x01FC
(HL),sINTSWI - sRAMprogStart + cRAMStartAdd
HL,0x01F8
(HL),sINTWDT - sRAMprogStart + cRAMStartAdd
Page 334
; Write data to the flash memory
; Sector Erase
; Chip Erase
; Check the status of the security program
; Configure the security program
; RAM start address
; Transfer the program from sRAMprogStart to
; sRAMprogEnd to cRAMStartAdd.
; Set INTUNDEF and INTSWI interrupt vectors
; Set INTWDT interrupt vector
TMP89FM42K

Related parts for tmp89fm42k