the corresponding block may not be changed. When a block is protected by clearing bits in both
FMPPEn
and
FMPREn
registers, execute-only protection can be achieved.
■
Flash Memory Protection Read Enable (FMPREn)
: If a bit is set in this register, the
corresponding block may be executed or read by software or debuggers. If a bits in this register
are cleared and the same block in the
FMPREn
register is cleared, the corresponding block may
only be executed, and contents of the memory block are prohibited from being read as data.
FMPREn
protection can be programmed in 2-KB increments, unlike the
FMPPEn
, which must
be programmed in 16-KB increments. However, if an application does want to read-protect a
16-KB block, eight bits need to be written from 1s to 0s.
The policies may be combined as shown in Table 8-2 on page 610.
Table 8-2. Flash Memory Protection Policy Combinations
Protection
FMPREn
FMPPEn
Execute-only protection. The block may only be executed and may not be written or erased.
This mode is used to protect code.
0
0
The block may be written, erased or executed, but not read. This combination is unlikely to
be used.
0
1
Read-only protection. The block may be read or executed but may not be written or erased.
This mode is used to lock the block from further modification while allowing any read or
execute access.
1
0
No protection. The block may be written, erased, executed or read.
1
1
A Flash memory access that attempts to read a read-protected block (
FMPREn
bit is clear) is
prohibited and generates a bus fault. A Flash memory access that attempts to program or erase a
program-protected block (
FMPPEn
bit is clear) is prohibited and can optionally generate an interrupt
(by setting the
AMASK
bit in the
Flash Controller Interrupt Mask (FCIM)
register) to alert software
developers of poorly behaving software during the development and debug phases.
The factory settings for the
FMPREn
and
FMPPEn
registers are a value of 1 for all implemented
banks. These settings create a policy of open access and programmability. The register bits may
be changed by clearing the specific register bit. The changes are not permanent until the register
is committed (saved), at which point the bit change is permanent. If a bit is changed from a 1 to a
0 and not committed, it may be restored by executing a any simulated power-on-reset (SIM_POR)
event. The changes are committed using the
Flash Memory Control (FMC)
register. Details on
programming these bits are discussed in “Non-Volatile Register Programming-- Flash Memory
Resident Registers” on page 613.
8.2.3.5
Execute-Only Protection
Execute-only protection prevents both modification and visibility to a protected flash block. This
mode is intended to be used in situations where a device requires debug capability, yet portions of
the application space must be protected from external access. An example of this is a company
that wishes to sell Tiva™ C Series devices with their proprietary software preprogrammed, yet allow
the end user to add custom code to an unprotected region of the flash (such as a motor control
module with a customizable motor configuration section in flash).
Literal data introduces a complication to the protection mechanism. When C code is compiled and
linked, literal data (constants, and so on) is typically placed in the text section, between functions,
by the compiler. The literal data is accessed at run time through the use of the LDR instruction,
which loads the data from memory using a PC-relative memory address. The execution of the LDR
instruction generates a read transaction across the Cortex-M3's DCode bus, which is subject to the
execute-only protection mechanism. If the accessed block is marked as execute only, the transaction
June 18, 2014
610
Texas Instruments-Production Data
Internal Memory