difference between SWI and TRAP

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

difference between SWI and TRAP

3,939件の閲覧回数
LBdgWgt
Contributor I
Hello all,

I am working on a project about RTOS on HCS12 uC. I whave a doubt about what is the difference between SWI and TRAP, as far as I read, both are not affected by I bit in CCR, does someone know what is the difference between both (advantage and disadvantage). The RTOS need a simulated interrupt whent performing context switching.

thansk for any help,
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

1,329件の閲覧回数
Steve
NXP Employee
NXP Employee
The instructions look similar but are intended for different uses. TRAP is in fact any unimplemented instruction in the S12(X) opcode map. So for S12 it is actually 202 opcodes and for S12XD it is 29 opcodes.
There are two disadvantages to using a TRAP instruction rather than SWI:
1/ The interrupt will be called by any of the unimplemented opcodes so any unintended software execution could cause a call to your RTOS kernel rather than being handled as an error.
2/ The TRAP availability is different on different CPUs (S12 vs S12X V1) and so code compatibility could be an issue for a flexible piece of code like an RTOS.
0 件の賞賛
返信

1,329件の閲覧回数
LBdgWgt
Contributor I
Thanks Steve for the very nice answer. I get it clearly now

regards,
0 件の賞賛
返信