the debugger vexes me!

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

First off let me say I really love avr studio. The visual studio esque layout is pretty helpful, and Ive grown accustomed to it. Though I was always a commandline, gcc, emacs kind of kid.) Whoops I'm rambling!

Ok the debugger pisses me off a little. It is jumping over non avr specific code.
Even after I set a breakpoint and just want it to step line by line from that point on it skips. Now I feel this may be to allow for something. Proper device timing or something when simulating maby? But as a kid trying to step through a big calculation function that has only 2 uc specific calls it irks me to have to pop breakpoints at half the lines.

Perhaps hopefully there is ways to configure it to do what I want.

Otherwise I think I may be worth thinking about when it comes time to tweak your debugging tool.

Hopefully I am not the only soul with this problem.

Using avr studio 4.13 with service pack 1, connected to a stk 500/501..

Thanks

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

Aren't you just describing optimisation artefacts here? How does it behave if you debug some -O0 code?

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

Quote:
It is jumping over non avr specific code.
I have NEVER had that problem with asm :wink:

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

grrr!! i lost a huge post i just made for this with a click mishap!!!

but here is the short of it

*/
ISR (TIMER0_OVF_vect){
	real_time++;			//since timer0 overflows at 255 i need this
	if (real_time==200){	//to hit target clock cout of about 3000
		real_time=0;
		C_FLIPBIT(r26);
		if (data_recieved==0){
			signal_timeout_count++;
		}//if
		else{
			signal_timeout_count=0;
		}//else
		if (low_power_check==1){
			master_power_down_count++;
		}//if
		else {
			master_power_down_count=0;
		}//else
		if (signal_timeout_count==10){
			C_SETBIT(r25);			//sets the signal timeout led
		}//if
		if (master_power_down_count==60){
			set_sleep_mode(SLEEP_MODE_IDLE);
			sleep_enable();
			sei();
			sleep_cpu();
			sleep_disable();
		}//if
	}//if
}//Timer 0 overflow interrupt

This is a upkeep interrupt that happens every min or so on a remote data reciever device

when i pop it in the debugger it skips everything except the setbit the flip bit and the sleep calls

oh and asm is cool...I should step up my skills with it...though i can be quite productive with c

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

Well unless you made signal_timeout_count (and others) volatile the chances are the copiler has simply optimised that code away - it'll see that nothing in the function makes use of those vars so will consider that generating code to update them is pointless. If you want to say "ah yes, but these variables ARE used elsewhere" (presumably in the main() code?) then that's the very reason for 'volatile'

(this is FAQ#1 in the avr-libc FAQ (and below) as it catches so many people)

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

Cliff! How about some betting on that the reason for debugging the ISR in the first place was that the update of the variables where not seen outside the ISR?

I'll bet one Guinness that it was!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Quote:
Cliff! How about some betting on that the reason for debugging the ISR in the first place was that the update of the variables where not seen outside the ISR?

I'll bet one Guinness that it was!

well actually the code works..but after reading up on volitile varibles im not sure why...i was just choosing a function at random with only a few avr specific calls ..so yall could see the debugger jump..

none the less...they are declared volitile now

meanwhile that I wish I had taken notice of your little faq signature clawson...I have been caught up on no les than 3 of those stumbling points in the last 2 weeks:-P thanks for pointing me to the avr libc faq..

And thanks all around for yalls help:-)

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

Glad that it worked out, and if I understand you correctly I now owe Cliff one Guinness.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

hehe...ya the isr worked before declareing those vars volatile...wierd right?

maby because i declared them globally and never directly used them in main...I guess it also coulda been working out of luck..

But dont let me jip ya on your beer:-P

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

Just a tip for anyone visiting Ireland - (IMHO, after a LOT of research) Murphy's is actually superior to Beamish which is superior to Guinness - though it's true that Guinness in Ireland always tastes FAR better than here in the UK - presumably because the high turnover of the "national drink" means it's always fresh?

@rubixcubix, the "volatile" thing is just a protection in case the optimiser decides to optimise variable access into none (externally) updated registers but this doesn't always happen (but when it does and you haven't made them volatile it's a right bugger trying to locate the fault!)