UM10413
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2011. All rights reserved.
User manual
Rev. 1 — 16 December 2011
248 of 268
NXP Semiconductors
UM10413
MPT612 User manual
27.4.9 Handling exceptions
This section describes the importance of sharing exception handlers between
RealMonitor and the user application.
27.4.10 RealMonitor exception handling
To function properly, RealMonitor must be able to intercept certain interrupts and
exceptions.
illustrates how exceptions can be claimed by RealMonitor itself, or
shared between RealMonitor and the application. If the user application requires
exception sharing, they must provide a function (such as app_IRQDispatch ()). Depending
on the nature of the exception, this handler can either:
•
Pass control to the RealMonitor processing routine, such as rm_irqhandler2().
•
Claim the exception for the application itself, such as app_IRQHandler ().
In a simple case where an application has no exception handlers of its own, the
application can install the RealMonitor low-level exception handlers directly into the vector
table of the processor. Although the IRQ handler must get the address of the Vectored
Interrupt Controller. The easiest way to do this is to write a branch instruction (<address>)
into the vector table, where the target of the branch is the start address of the relevant
RealMonitor exception handler.
27.4.11 RMTarget initialization
While the processor is in a privileged mode, and IRQs are disabled, the user must include
a line of code within the start-up sequence of the application to call rm_init_entry().
27.4.12 Code example
The following example shows how to set up the stack, VIC, initialize RealMonitor and
share non-vectored interrupts:
IMPORT rm_init_entry
Fig 73. Exception handlers
aaa-000635
SWI
DATA ABORT
RESERVED
IRQ
FIQ
UNDEF
RM_UNDEF_HANDLER()
RM_PREFETCHABORT_HANDLER()
RM_DATAABORT_HANDLER()
RM_IRQHANDLER()
RESET
RealMonitor supplied exception vector handlers
sharing IRQs between RealMonitor and user IRQ handler
APP_IRQDISPATCH
OR
RM_IRQHANDLER2()
APP_IRQHANDLER2()
PREFETCH
ABORT