EmbeddedRelated.com
Forums

How to create nested interrupts for the SAM7?

Started by ratb...@... November 21, 2005
In one the posts someone wrote:

\



In one the posts someone wrote:

"The only way to make a good interrupt system is to use assembler
wrappers to call C functions. The ___xxx keywords are compiler specific
and make various assumptions about the interrupt policies you are using.

The return from an interrupt is different to a regular return. If you
want to perform nested interrupts, then you also need code to save away
some context then switch to system mode for execution.

All interrupts must start off in ARM mode (the CPU switches to ARM mode
for all exceptions), though you can then switch to thumb during the
interrupt handling."

Does anyone know how to do this? If you do, Can you post some example code on how to go about this.

Any help on this matter will be greatly appreciated.
_________________
Best regards,
-JB



Hi rat,

Switching to Thumb execution in ISR can easily be done by using the non-HW vectored AIC
Interrupt service. (you have to set the AIC for it).
From within this ISR, call the SVR vector with a function pointer, then
write AIC_EOICR to mark End of ISR, and exit.

The function pointer would point to your actual ISR (wrapper) function, which would
be a standard C function, NOT an ISR -> void your_func (void).

All you have to do now is to set the compiler to generate Thumb code for your_func().

B rgds
Kris

>-----Original Message-----
>From: AT91SAM7@AT91... [mailto:AT91SAM7@AT91...] On Behalf Of
>ratbastard2k3@ratb...
>Sent: Tuesday, 22 November 2005 9:36 AM
>To: AT91SAM7@AT91...
>Subject: [AT91SAM7] How to create nested interrupts for the SAM7?
>
>In one the posts someone wrote:
>
>"The only way to make a good interrupt system is to use assembler
>wrappers to call C functions. The ___xxx keywords are compiler specific
>and make various assumptions about the interrupt policies you are using.
>
>The return from an interrupt is different to a regular return. If you
>want to perform nested interrupts, then you also need code to save away
>some context then switch to system mode for execution.
>
>All interrupts must start off in ARM mode (the CPU switches to ARM mode
>for all exceptions), though you can then switch to thumb during the
>interrupt handling."
>
>Does anyone know how to do this? If you do, Can you post some example code on how to go
>about this.
>
>Any help on this matter will be greatly appreciated.
>_________________
>Best regards,
>-JB >
>
>Yahoo! Groups Links >
>


I already posted an example in the file section on how to do this:
sam7s64-gcc.tgz

This code calls thumb and does nesting etc.

The only difference between ARM-only and thumb capable is that interworking is
added. Interworking supports both thumb and ARM. The interworking is done by
using bx to call the ISR rather than BL. On Tuesday 22 November 2005 11:35, ratbastard2k3@ratb... wrote:
> In one the posts someone wrote:
>
> "The only way to make a good interrupt system is to use assembler
> wrappers to call C functions. The ___xxx keywords are compiler specific
> and make various assumptions about the interrupt policies you are using.
>
> The return from an interrupt is different to a regular return. If you
> want to perform nested interrupts, then you also need code to save away
> some context then switch to system mode for execution.
>
> All interrupts must start off in ARM mode (the CPU switches to ARM mode
> for all exceptions), though you can then switch to thumb during the
> interrupt handling."
>
> Does anyone know how to do this? If you do, Can you post some example code
> on how to go about this.
>
> Any help on this matter will be greatly appreciated.
> _________________
> Best regards,
> -JB >
>
> Yahoo! Groups Links >