Simulator doesnt stop on breakpoint within interrupt.

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it me?

Just started using 'new' AVR studo and WinAVR.
Program never appears to stop on a breakpoint when it's set within an interrupt bit of code.

Mega168 - in simulator mode. ( not yet tried JTAGiceMk2 )

AVR Studio 4.13.528
GUI Version 4, 13, 0, 528
AVR Simulator 1, 0, 2, 0

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you sure it even gets there?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How are you "triggering" the interrupt? Is your code written in C? If so do you have optimisation off? I put breakpoints in ISR all the time and it works....well at least with real hardware.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, it gets there.
The timer interrupt increments a counter amongst other things, the program works, but it wont stop on the breakpoints set withing the interrupt.

This is at -O3 optimisation, interestingly at this optimisation, there become 'fewer points' at which I can actually set the breakpoints, I'm not sure why this is - I'm sure someone will enlighten me.

I assume if I can set a breakpoint - it should actually stop there.

If I set a data breakpoint on access to the counter, then the code appears to break right at the start of the Interrupt routine - even though the variable is actually incremented within a subsequent nested function. I cannot step throught the interrupt from this point. Wierd.

I haven't yet tried it at zero optimisation, nor on the JTAGICE Mk2. - Tomorrows task unless a specific reason is forthcoming.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
This is at -O3 optimisation
Try it at -O0 optimisation.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
I have similar problem. My interrupt routine never executes. I can see comapre match occured and Output compare flag 0A- OCF0A is set in TIFR register, but execution didn't go to interrupt either I step through it or when I put a brake point.

Can anybody please help, why this is happening....
Thanks

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You never write anything in TIMSK0 (or TIMSK depending on the AVR). This is where the specific timer interrupt must be enabled.

SIGNAL(SIG_TIMER1_COMPA)

You need a SIGNAL (or ISR) for timer 0 and not timer 1 right?
/Lars

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks,
I did enabled Timer0 interrupts and is working fine. My executions stops in interrupts as well.
Previously, I was under the impression that timer0 interrupts were enabled by default.
Thanks again..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok - When I use optimisation -O3 the ( in the simulator ) the breakpoints that are set within the interrupt routing DO NOT function )

AVR Studio DOES indicate that the interrupt has been set!

I know the interrupt is working - the hardware works, and a test pin toggles within the interrupt routine.

No matter where I put a breakpoint within the interrupt routing - AVR Studio does NOT stop!

If I then use optimisation -O0, things seem to work ok ( Breaks work within interrupt )

I have yet to prove this on the Hardware with the JTAGMk2.

I could understand if AVR studio didnt let me set the breakpoint - for whatever reason - but it does let me set the breakpoint.

So - if I run with -O3 optimisation, I can't debug within an interrupt routine!

Is this a bug - or am I doing something wrong?

Help please!!!

As as aside - when I hit the 'Start Debugging' box, There is a LONG time spent with the eggtimer up before the thing actually downloads the code into the JTAG ICE Mk2. This wasn't the case on previous versions I have been using - any info?

Following data is the setup I have:-

AVR Studio 4.13.528
GUI Version 4, 13, 0, 528
JTAGICE mkII 1, 0, 1, 140
ATmega168 190

Operating System
Major 5
Minor 1
PlatformID 2
Build 2600
Service Pack 2

Plugins:

AvrPluginAvrAsmObject 1, 0, 0, 45
AvrPluginavrgccplugin 1, 0, 0, 7
Stk500Dll 1, 0, 1, 0

------------------------------------------------

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
am I doing something wrong?
You are doing something wrong, you are using C :) you can't tell IT what to do, you are it's servant, if it does not want to break at a breakpoint there is nothing you can do to make it stop..

Switch to the diassembler view, it may be better, but still some C code will not translate to processor code the way you think it should with optimisation on, or at least that's what I have been told...don't quite understand this but it is so. And by the way, don't rely too much on the simulator, try and use real hardware with a debugger.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well - I still cant quite see WHY AVRStudio actually shows me the breakpoint that is set - it SHOULD stop there if I know the code actually does get executed.
I appreciate that it seems not always to allow you to set the breakpoint exactly where you would like it - but I would have expected it to break correctly if it SHOWS a breakpoint has actually been added.

Comments from the developers would be appreciated.