Question about SWI vector

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

Question about SWI vector

Jump to solution
767 Views
bobkang
Contributor II

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.

Labels (1)
Tags (2)
0 Kudos
1 Solution
531 Views
lydia_ziegler
NXP Employee
NXP Employee

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!

View solution in original post

0 Kudos
3 Replies
532 Views
lydia_ziegler
NXP Employee
NXP Employee

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!

0 Kudos
531 Views
bobkang
Contributor II

:smileyhappy:Thanks!Lydia. But could you explain more about "add a routine that the SWI vector points to"?

0 Kudos
531 Views
lydia_ziegler
NXP Employee
NXP Employee

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