![NXP Semiconductors MC9S08LG16 Reference Manual Download Page 66](http://html1.mh-extra.com/html/nxp-semiconductors/mc9s08lg16/mc9s08lg16_reference-manual_1721837066.webp)
Chapter 4 Memory
MC9S08LG32 MCU Series, Rev. 5
66
Freescale Semiconductor
FPS bits must be set to 1111 100, which results in the value 0xF9FF as the last address of unprotected
memory. In addition to programming the FPS bits to the appropriate value, FPDIS (bit 0 of NVPROT)
must be programmed to logic 0 to enable block protection. Therefore the value 0xF8 must be programmed
into NVPROT to protect addresses 0xFA00 through 0xFFFF.
Figure 4-4. Block Protection Mechanism
One use of block protection is to block protect an area of flash memory for a bootloader program. This
bootloader program then can be used to erase the rest of the flash memory and reprogram it. Because the
bootloader is protected, it remains intact even if MCU power is lost in the middle of an erase and
reprogram operation.
4.6.7
Vector Redirection
Whenever any block protection is enabled, the reset and interrupt vectors are protected. Vector redirection
allows users to modify interrupt vector information without unprotecting bootloader and reset vector
space. Vector redirection is enabled by programming the FNORED bit in the NVOPT register located at
address 0xFFBF to zero. For redirection to occur, at least some portion but not all of the flash memory
must be block protected by programming the NVPROT register located at address 0xFFBD. All of the
interrupt vectors (memory locations 0xFFC0–0xFFFD) are redirected, though the reset vector
(0xFFFE:FFFF) is not.
For example, if 512 bytes of flash are protected, the protected address region is from 0xFE00 through
0xFFFF. The interrupt vectors (0xFFC0–0xFFFD) are redirected to the locations 0xFDC0–0xFDFD. For
instance, if an SPI interrupt is taken, the values in the locations 0xFDE8:FDE9 are used for the vector
instead of the values in the locations 0xFFE8:FFE9. This allows you to reprogram the unprotected portion
of the flash with new program code including new interrupt vector values while leaving the protected area,
which includes the default vector locations, unchanged.
4.7
Security
The MC9S08LG32 series includes circuitry to prevent unauthorized access to the contents of flash and
RAM memory. When security is engaged, flash and RAM are considered secure resources. Direct-page
registers, high-page registers, and the background debug controller are considered unsecured resources.
Programs executing within secure memory have normal access to any MCU memory locations and
resources. Attempts to access a secure memory location with a program executing from an unsecured
memory space or through the background debug interface are blocked (writes are ignored and reads return
all 0s).
Security is engaged or disengaged based on the state of two nonvolatile register bits (SEC01:SEC00) in
the FOPT register. During reset, the contents of the nonvolatile location NVOPT are copied from flash into
the working FOPT register in high-page register space. To engage security, program the NVOPT location.
FPS7
FPS6
FPS5
FPS4
FPS3
FPS2
FPS1
A15
A14
A13
A12
A11
A10
A9
A8
1
A7 A6 A5 A4 A3 A2 A1 A0
1
1
1
1
1
1
1
1
Summary of Contents for MC9S08LG16
Page 2: ......
Page 4: ......
Page 8: ......
Page 20: ......
Page 26: ...Chapter 1 Device Overview MC9S08LG32 MCU Series Rev 5 26 Freescale Semiconductor...
Page 40: ...Chapter 2 Pins and Connections MC9S08LG32 MCU Series Rev 5 40 Freescale Semiconductor...
Page 372: ......