From 458a2834834986bc13171439b2f6889ad14044b8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 28 Dec 2008 13:17:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@549 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- docs/ch.txt | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'docs/ch.txt') diff --git a/docs/ch.txt b/docs/ch.txt index 4db76915a..46fd52004 100644 --- a/docs/ch.txt +++ b/docs/ch.txt @@ -159,11 +159,34 @@ * architecture. *
  • FIQ sources can preempt the kernel (by design) so it is not possible to * invoke the kernel APIs from inside a FIQ handler.
  • + *
  • Interrupt handlers do not save function-saved registers so you need to + * make sure your code saves them or does not use them (this happens + * because in the ARM7 port all the OS interrupt handlers are declared + * naked).
    + * Function-trashed registers (R0-R3,R12,LR,SR) are saved/restored by the + * system macros \p chSysIRQEnterI() and \p chSysIRQExitI().
    + * The easiest way to ensure this is to just invoke a function from within + * the interrupt handler, the function code will save all the required + * registers.
    + * Example: + * @code + * __attribute__((naked, weak)) + * void irq_handler(void) { + * chSysIRQEnterI(); + * + * serve_interrupt(); + * + * VICVectAddr = 0; // This is LPC214x-specific. + * chSysIRQExitI(); + * } + * @endcode + * This is not a bug but an implementation choice, this solution allows to + * have interrupt handlers compiled in thumb mode without have to use an + * interworking mode (the mode switch is hidden in the macros), this + * greatly improves code efficiency and size. You can look at the serial + * driver for real examples of interrupt handlers.
  • * *

    - *

    - * The ARM7 port is shared by multiple demos targeted to various implementations: - *

    * @ingroup Ports */ /** @} */ -- cgit v1.2.3