Texas Instruments Development Kit for TM4C129x,Tiva™ ARM® Cortex™ -M4 Microcontroller DK-TM4C129X DK-TM4C129X Datenbogen

Produktcode
DK-TM4C129X
Seite von 2182
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 640.
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 643.
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
is blocked, and the processor is prevented from loading the constant data and, therefore, inhibiting
correct execution. Therefore, using execute-only protection requires that literal data be handled
differently. There are three ways to address this:
1.
Use a compiler that allows literal data to be collected into a separate section that is put into one
or more read-enabled flash blocks. Note that the LDR instruction may use a PC-relative address,
December 13, 2013
640
Texas Instruments-Advance Information
Internal Memory