[coldfire-gnu-discuss] ColdFire Interrupts
Nathan Sidwell
nathan at codesourcery.com
Wed Jul 2 07:39:50 UTC 2008
Corrin Meyer wrote:
> According to the ColdFire datasheets, on entering of an ISR, the only
> first instruction is guaranteed to run with interrupts disabled, and
> therefore should modify the status register. Since on interrupt, the
> processor creates an exception stack frame in which the status register
> (SR) is stored, the first instruction in an ISR should load an immediate
> value into SR. Either that, or use the ‘STRLDSR’ instruction. However,
> even with a function marked with “__attribute__((interrupt))” GCC
> doesn’t seem to generate these instructions. I also noticed that none
> of the CS3 default interrupts do this.
> Is this the intended functionality? Am I correct in assuming that the
> only way to write truly correct ISRs is to do so in assembly (or at
> least use assembly as a wrapper before calling C code)?
The SR interrupt mask is automatically set to the level of the current
interrupt, so you only need the functionality you ask for when you want to
disable all interrupts from the very start of the interrupt routine. You could
of course disable all interrupts later within the routine, but that does mean
there is a part of the routine that is preemptable (but not necessarily reentrant)
I have filed an internal enhancement request.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
More information about the coldfire-gnu-discuss
mailing list