English
Language : 

TMP89FW24AFG Datasheet, PDF (446/548 Pages) Toshiba Semiconductor – 8 Bit Microcontroller TLCS-870/C1 Series
24. Flash Memory
24.4 Access to the Flash Memory Area
TMP89FW24A
24.4.2.3 How to set the security program by using a support program (API) of BOOTROM
1. Transfer the subroutine program of nonmaskable interrupt (INTSWI and INTWDT) to RAM.
2. Establish the nonmaskable interrupt vector in the RAM area.
3. After setting "1" to both SYSCR3<RAREA> and SYSCR3<RVCTR>, set "0xD4" on
SYSCR4. Then allocate RAM to the code area, and switch the vector area to the RAM area.
4. Set "1" on FLSCR1<BAREA>.
5. Set "0xD5" on the A register as Enable Code.
6. Disable mapping of shadow RAM in the data area.
7. Call .BTGetSP(0x1016). (After processing, security program state returns to the A register)
8. Read the A register, and then jump to the sSKIP because the security program is already set.
9. Set "0xD5" to the A register as Enable Code.
10. Call .BTSetSP(0x1018). (Security Program is performed.)
11. Set "0" on FLSCR1<BAREA>, and set "0xD5" on FLSCR2.
12. After setting "0" to both SYSCR3<RAREA> and SYSCR3<RVCTR>, set "0xD4" on SYSCR4.
13. Enable mapping of shadow RAM in the data area.
(Example)
Check the setting of Security Program(SB2). If it is not set yet, set Security Program(SB2).
2012/5/18
RA000
.BTReset
equ 0x1000
; Generate system clock reset.
.BTWrite
equ 0x1010
; Write data to the flash memory
.BTEraseSec equ 0x1012
; Sector Erase
.BTEraseChip equ 0x1014
; Chip Erase
.BTGetSP
equ 0x1016
; Check the state of Security Program
.BTSetSP
equ 0x1018
; Set Security Program
.BTRead
equ 0x101A
; Read data from the flash memory
.BTConvAdr equ 0x101C
; Address conversion
.BTCalcUART equ 0x101E
; Calculate the setting value of UART from the timercapture value
.BTErsSP
equ 0x1020
; Disable Security Program
.BTUpdSD equ 0x1022
; Shadow RAM update
main section code abs = 0x1F000
; #### Set a nonmaskable interrupt vector to .BTReset ####
LD
HL,0x01FC
; Set INTUNDEF and INTSWI interrupt vector
LDW
(HL),.BTReset
LD
HL,0x01F8
; Set INTWDT interrupt vector
LDW
(HL),.BTReset
; #### Allocate RAM to the code area. Switch the vector area to RAM ####
LD
(SYSCR3),0x06
; Set RAREA = 1 and RVCTR = 1
LD
(SYSCR4),0xD4
; Enable Code
; #### Allocate BOOTROM to data/code area ####
LD
(FLSCR1),0x50
; Set "1" to BAREA
Page 430