Set a watchpoint to break on interrupts enabled/disabled

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

Set a watchpoint to break on interrupts enabled/disabled

ソリューションへジャンプ
4,032件の閲覧回数
roman_g
Contributor I

I need to stop debugging when global interrupts bit changes (HCS08).

 

How do I do that?

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
2,156件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

Watchpoinits on registers are not supported for efficiency reasons, so that wont work :smileysad:.

 

元の投稿で解決策を見る

0 件の賞賛
返信
8 返答(返信)
2,156件の閲覧回数
J2MEJediMaster
Specialist I

Set a watchpoint on the register.

 

---Tom

 

0 件の賞賛
返信
2,157件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

Watchpoinits on registers are not supported for efficiency reasons, so that wont work :smileysad:.

 

0 件の賞賛
返信
2,156件の閲覧回数
J2MEJediMaster
Specialist I

OK, so here's where I try to extract myself gracefully from giving a bogus answer. Poll the register's contents, placing a copy into memory. Set a watchpoint on that.

 

---Tom

 

0 件の賞賛
返信
2,156件の閲覧回数
roman_g
Contributor I

How do I do that?

 

I need to detect interrupts being disabled, so I can't use interrupts for polling.

 

Do you suggest using BDC?

0 件の賞賛
返信
2,156件の閲覧回数
bigmac
Specialist III

Hello,

 

I presume that the reason the I-bit becomes set is because you have commenced an interrupt process.  Otherwise, the flag would need to be explicitly set and cleared from within your code.

 

It might be possible to add some test code, as previously suggested, at the start of each ISR so that a break would occur when any ISR was entered.

 

What sort of problem are you trying to debug?  Do you have normal functions that are setting the flag, and then not re-enabling interrupts?  Perhaps you are attempting to implement nested interrupts?

 

Regards,

Mac

 

0 件の賞賛
返信
2,156件の閲覧回数
roman_g
Contributor I
I got a load of spaghetti code, and I suspect somewhere in that code an interrupt gets enabled. Textual search came back empty, perhaps because there is more than one way to set I-bit (sei, tap, macros)
0 件の賞賛
返信
2,156件の閲覧回数
bigmac
Specialist III

Hello,

 

I assume that your "spaghetti code" is actually written in assembly language.  Is this correct?  It is not entirely clear whether your problem is that interrupts become globally enabled when they should not, or whether interrupts are being globally disabled and not re-enabled.  (Setting the I-bit disables interrupts.)

 

A common cause for interrupts to become enabled when they should not might be due to interrupts being disabled within a sub-routine.  The software author then assumes that interrupts were previously enabled, so erroneously re-enables interrupts prior to exiting the sub-routine.  Be wary of the use of any CLI instructions within the code.  Apart from the enabling of interrupts during initialisation, I presume that there would be little need for use of the instruction.

 

If interupts need to be temporarily disabled within a sub-routine, the method I would normally use would be -

 

   TPA

   PSHA   ; Status register value to stack

   SEI    ; Disable interrupts

 

   ; Critical code here

 

   PULA

   TAP    ; Restore prior state

 

 I guess that you will need to write the special test code for de-bugging as a macro, and then selectively incorporate the macro within each sub-routine, just prior to exiting.

 

Regards,

Mac

 

 

 

0 件の賞賛
返信
2,156件の閲覧回数
roman_g
Contributor I

On "Controlpoints Configuration" form, Watchpoints tab, there are few fields I need to specify to create a watchpoint:

1. "Address" - what do I specify as an address for status (SR or CCR) register? it is not mapped in memory.

2. "Condition" - I need something like "CCR & 0x08" to trigger the watchpoint on I (global interrupts mask) bit set.

0 件の賞賛
返信