System programming UM0404
558/564 DocID13284 Rev 2
If the internal Flash only contains the start-up code and/or test software, the system may be
booted from internal Flash, which may then be disabled, after the software has switched to
executing from external memory, in order to free the address space occupied by the internal
Flash area, which is now unnecessary.
27.11 Pits, traps and mines
Although handling the internal Flash provides powerful means to enhance the overall
performance and flexibility of a system, extreme care must be taken in order to avoid a
system crash. Instruction memory is the most crucial resource for the ST10F276 and it must
be made sure that it never runs out of it.
The following precautions help to take advantage of the methods mentioned above without
jeopardizing system security.
Internal Flash access after reset: When the first instructions are to be fetched from
internal Flash (EA = ā1ā), the memory must contain a valid reset vector and valid code at its
destination.
Mapping the internal Flash to segment 1: Due to instruction pipelining, any new Flash
mapping will at the earliest become valid for the second instruction after the instruction
which has changed the Flash mapping. To enable accesses to the Flash after mapping a
branch to the newly selected Flash area (JMPS) and reloading of all data page pointers is
required.
This also applies to re-mapping the internal Flash to segment 0.
Enabling the internal Flash after reset: When enabling the internal Flash after having
booted the system from external memory, note that the ST10F276 will then access the
internal Flash using the current segment offset, rather than accessing external memory.
Disabling the internal Flash after reset: When disabling the internal Flash after having
booted the system from there, note that the ST10F276 will not access external memory
before a jump to segment 0 (in this case) is executed.
General rules
When mapping the Flash no instruction or data accesses should be made to the internal
Flash, otherwise unpredictable results may occur.
To avoid these problems, the instructions that configure the internal Flash should be
executed from external memory or from the IRAM.
Whenever the internal Flash is disabled, enabled or re-mapped the DPPs must be explicitly
(re)loaded to enable correct data accesses to the internal Flash and/or external memory.