Here, I explain the trick and simplify the code from the application note. The focus is on an "in-field" firmware update procedure. The LPC microcontroller series is built on the ARM7 core and provides a generous assortment of on-chip peripherals. In-System Programming is an attractive option for in-field firmware update, because the bootloader supports code uploading via an RS
|Published (Last):||13 February 2011|
|PDF File Size:||9.92 Mb|
|ePub File Size:||19.35 Mb|
|Price:||Free* [*Free Regsitration Required]|
All rights reserved. User manual LPCx Rev. Prefetch abort and data abort exceptions The LPCx generates the appropriate bus cycle abort exception if an access is attempted for an address that is in a reserved or unassigned address region. Labelled "Reserved Address Space" in Figure 2—2. See Figure 2—3. See Figure 2—4. See Table 2—2. For these areas, both attempted data access and instruction fetch generate an exception.
Within the address space of an existing APB peripheral, a data abort exception is not generated in response to an access to an undefined address. Address decoding within each peripheral is limited to that needed to distinguish defined registers within the peripheral itself.
For example, an access to address 0xE D an undefined address within the UART0 space may result in an access to the register defined at address 0xE C Details of such address aliasing within a peripheral space are not defined in the LPCx documentation and are not a supported feature. Note that the ARM core stores the Prefetch Abort flag along with the associated instruction which will be meaningless in the pipeline and processes the abort only if an attempt is made to execute the instruction fetched from the illegal address.
This prevents accidental aborts that could be caused by prefetches that occur when code is executed very near a memory boundary. The LPCx uses one bank of Flash memory, compared to the two banks used on predecessor devices. It includes three bit buffers called the Prefetch Buffer, the Branch Trail Buffer and the data buffer.
When an Instruction Fetch is not satisfied by either the Prefetch or Branch Trail Buffer, nor has a prefetch been initiated for that line, the ARM is stalled while a fetch is initiated for the bit line.
If a prefetch has been initiated but not yet completed, the ARM is stalled for a shorter time. Unless aborted by a data access, a prefetch is initiated as soon as the Flash has completed the previous access.
The prefetched line is latched by the Flash module, but the MAM does not capture the line in its prefetch buffer until the ARM core presents the address from which the prefetch has been made. If the core presents a different address from the one from which the prefetch has been made, the prefetched line is discarded.
During sequential code execution, typically the Prefetch Buffer contains the current instruction and the entire Flash line that contains it. The MAM differentiates between instruction and data accesses. Code and data accesses use separate bit buffers. The fourth eighth, 16th sequential data access must access Flash, aborting any prefetch in progress. When a Flash data access is concluded, any prefetch that had been in progress is re-initiated.
Timing of Flash read operations is programmable and is described later in this section. In this manner, there is no code fetch penalty for sequential instruction execution when the CPU clock period is greater than or equal to one fourth of the Flash access time. This conditional execution may often be used to avoid small forward branches that would otherwise be necessary.
Branches and other program flow changes cause a break in the sequential flow of instruction fetches described above. The Branch Trail Buffer captures the line to which such a non-sequential break occurs. If the same branch is taken again, the next instruction is taken from the Branch Trail Buffer.
When a branch outside the contents of the Prefetch and Branch Trail Buffer is taken, a stall of several clocks is needed to load the Branch Trail buffer.
Subsequently, there will typically be no further instructionfetch delays until a new and different branch occurs.
Philips ISYSTEM LPC2138 User Manual
LPC2100: Entering ISP mode from user code