Forcing user defined iterrupts on the M52233

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Forcing user defined iterrupts on the M52233

1,779 Views
DustinK
Contributor I
Hello everyone,

I have spent the last couple days looking through the documentation, scouring the freescale forums and the rest of the internet and have been unable to find a way to easily generate an interrupt from within code. I have an interrupt that I need to trigger in order to modify the exception stack frame, however, I need to do this via software, not hardware or peripheral interrupt. I have PIT0 working properly as needed, but this next step is not behaving. I've attempted using MCF_INTC_INTFRCH() and MCF_INTC_INTFRCL(), but doing that I either get nothing, or I get an interrupt on vector 2 which gives me 'Access Error -- PC = Error on operand read' If i enable printf debugging, and I get this regardless of which interrupt I try to force. I figure I'm missing some simple step, but I'm a loss for what it might be. I've tried messing with masks as well, but from the manual, those shouldn't matter since INTFRCL/H ignores the masks. Any help, direction, input, etc would be greatly appreciated.

Thanks you,

Dustin Knie
Labels (1)
0 Kudos
Reply
4 Replies

796 Views
SimonMarsden_de
Contributor II
Could you explain a bit more what you're hoping to do?

There's a software instruction called TRAP that will cause an exception. It allows code written in User mode to get back into Supervisor mode in a controlled way. (However it's not quite the same as forcing a hardware interrupt from software). Not sure if that's what you're thinking of?
0 Kudos
Reply

796 Views
DustinK
Contributor I
Hmm. Trap may work, except I'm currently working exclusively in supervisor mode.  The primary objective currently is to trigger an exception, so I can modify the exception stack frame and cause (in a sense) a process to be spawned as a result.  I'm building the start of a scheduler system for a basic RTOS.  The idea here is for a idle task to be spawned on startup by using interrupts.

The other snag I've ran into is, I'm not sure I've been utilizing the interrupt force register properly, since I cannot get reliable operation out of it. Is there anything specific I need to do other than set the interrupt flag that I want to trigger?
0 Kudos
Reply

796 Views
SimonMarsden_de
Contributor II
If you're in Supervisor mode already you don't even need to use a TRAP instruction.

There's nothing particularly special about an exception stack frame. It's quite easy to fake one up simply by pushing the correct values onto the stack. You can write a little bit of assembler code to do this.

The exception stack frame format is documented in the ColdFire Family Programmer's Reference Manual.


Hope this helps


Simon


0 Kudos
Reply

796 Views
DustinK
Contributor I
Thanks for the reply.  As I figured I was missing something simple and have gotten the interrupts to fire properly finally.  I forgot to actually set the interrupt force register value to anything, i was just reading from it.  As for the exception stack frame, it doesn't look to difficult. I haven't spent a lot of time actually figuring out how to modify it though.  I know how its laid out, its just a matter of accessing and modifying it.  I tried a few things borrowing from the asm_exception_isr in the base code that's generated with a new project in CW7.0 but so far I haven't succeeded in getting it to work properly.  I'll look at it again in a bit, right now I have some other tasks to take care of.

Thanks,

Dustin
0 Kudos
Reply