TC1796
System Units (Vol. 1 of 2)
Program Memory Unit
User’s Manual
7-32
V2.0, 2007-07
PMU, V2.0
7.2.7.3
Read Protection for PFLASH and DFLASH
When read protection is active, read accesses from PFLASH and DFLASH memory
locations are generally disabled, if code execution is not started from internal Flash after
reset. Additionally, a global write protection is always active for a read-protected
PFLASH and DFLASH. This feature supports a protection against trojan horse
programs. Note that read protection cannot be activated separately for PFLASH and
DFLASH.
Read protection is installed only via UCB0. At programming of UCB0, the highest bit of
its second byte (corresponds to bit PROCON0.RPRO, see
) must be set.
After the configuration and confirmation of UCB0 (see
), read protection is
installed but still not active. After the following reset operation, the installed read
protection becomes really active. It remains active as long as no Disable Read
Protection command is issued. This command is password-protected and the user must
provide the two passwords for temporarily disabling the read protection. This mechanism
assures, that an installed read protection configuration can only be changed (e.g.
disabled) by an user which has knowledge about the two keywords that have been
initially programmed into the UCB. After the Disable Read Protection command, the read
protection configuration as defined in UCB0 can be changed (after erasing UCB0), if not
coincidently sector write protection is installed by the user 0 (in this case, also sector
write protection must be disabled). A temporarily disabled read protection can be re-
enabled by sending the Resume Protection command, or by executing a reset operation.
Read protection can be combined with sector specific write protection. In this case, after
execution of the Disable Read Protection command, only those sectors are unlocked for
write accesses, which are not separately write-protected.
The status of a correctly installed read protection is indicated by:
•
Status flag FSR.RPROIN = 1; this bit becomes updated after a reset operation (when
the Boot ROM code has been left) and when read protection has been configured.
•
Status flag PROCON0.RPRO = 1; indicates an installed (and confirmed) read
protection as programmed in the protection configuration bits of UCB0.
•
Read protection active flag FCON.RPA; indicates the state of an installed read
protection (active or temporarily disabled).
There are also two Flash access disable bits in register FCON, DCF (= Disable Code
Fetch) and DDF (= Disable Data Fetch), which control the Flash access during an active
read protection. During execution of the Boot ROM program (see
) with read
protection, the following three locations for program code execution can be selected:
•
Case 1: code execution from internal PFLASH
•
Case 2: code execution from internal program memory after execution of a bootstrap
loader
•
Case 3: code execution from external program memory via EBU