Question about SWI vector

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Question about SWI vector

跳至解决方案
1,047 次查看
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.

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
811 次查看
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 项奖励
回复
3 回复数
812 次查看
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 项奖励
回复
811 次查看
bobkang
Contributor II

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

0 项奖励
回复
811 次查看
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