Hi folks,
Currently I am a embedded software engineer and working on coding with a Soc using MC9S08AC128.
During debugging the program I found that the program go into the SWI vector somehow but I don't know why.
Is somebody know on what condition the program will step into SWI vector?
I will greatly appreciate your answer and help.
已解决! 转到解答。
Hi,
It could be a couple of things. The debug module can generate an SWI under certain circumstances. You may be seeing code run-away due to a variety of things. Have you checked your PRM/vector file to make sure this vector is properly assigned? You could add a routine that the SWI vector points to so you can catch the code when it triggers. By adding this hook, maybe you can narrow down what it was doing before it executed.
Hope this helps!
Hi,
It could be a couple of things. The debug module can generate an SWI under certain circumstances. You may be seeing code run-away due to a variety of things. Have you checked your PRM/vector file to make sure this vector is properly assigned? You could add a routine that the SWI vector points to so you can catch the code when it triggers. By adding this hook, maybe you can narrow down what it was doing before it executed.
Hope this helps!
Hi,
Sure. It depends on how you are building your project in CodeWarrior. If you are using the PRM, the Vector table will be there (It would be "VECTOR 1"). If you are using Processor Expert, the Vector table will be in the MCUinit.c file (called "isrVswi" by default). Just use the vector table to point to a routine when the SWI triggers. I would think something like this would be good to 'catch' the MCU so you can see what state it is in:
__interrupt void isrVswi(void)
{
for (;;);
}
Hope this helps,
Lydia