Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

AVR Studio breakpoints

AVR Studio breakpoints

2012-08-19 by englsprogeny1

As some of you know, I'm migrating to include AVR studio in my projects, instead of just what comes with WinAVR

Below I try to set a breakpoint but AVR Studio moves this breakpoint down:


I set the breakpoint at the line:  PORTA = inputButtons;

but AVR Studio moves this breakpoint down to PORTA = ~counter;


Looking at the code I do not believe that the line that I want to break on is optimized out.

Why is AVR Studio moving my breakpoint?

Thanks for any input.


//----- Include Files ---------------------------------------------------------
#include <avr/io.h>		// include I/O definitions (port names, pin names, etc)
#include <avr/interrupt.h>	// include interrupt support
#include <avr/signal.h>
#include <avr/delay.h>


unsigned char localBufferLength = 0x20;

unsigned char dataRead;

void PrintMenu(void);
void ProgMain(void);

//----- Begin Code ------------------------------------------------------------

int main(void)
{


	//Port A is output
	DDRA=0xFF;	
	
	
	//Port A is input
	DDRB=0x00;	
	PORTB = 0xFF;  //Pullups
	
	ProgMain();
	
	return 0;
}


void ProgMain(void)
{
	
	unsigned char counter = 0;
	unsigned char inputButtons;
 
	while(1)
	{
	
		_delay_ms(20);
		
		inputButtons = PINB;
		
		
		if(counter<255)
		{
			counter++;
		}
		else
			counter = 0;
		
	
		inputButtons = inputButtons & 0x0F;
	
		if(inputButtons != 0x0F)
		{
		
			PORTA = inputButtons;
		}
		else
		{
			PORTA = ~counter;
		}
	
		
			
	}
		
		

		

	


}

Re: AVR Studio breakpoints

2012-08-19 by englsprogeny1

Note:

I'm using AVR Studio 4.18
I used the wizard to make the project (no external makefiles)

The app does stop at the 'phantom breakpoint' 



--- In AVR-Chat@yahoogroups.com, "englsprogeny1" <englsprogeny1@...> wrote:
Show quoted textHide quoted text
>
> As some of you know, I'm migrating to include AVR studio in my projects, instead of just what comes with WinAVR
> 
> Below I try to set a breakpoint but AVR Studio moves this breakpoint down:
> 
> 
> I set the breakpoint at the line:  PORTA = inputButtons;
> 
> but AVR Studio moves this breakpoint down to PORTA = ~counter;
> 
> 
> Looking at the code I do not believe that the line that I want to break on is optimized out.
> 
> Why is AVR Studio moving my breakpoint?
> 
> Thanks for any input.
> 
> 
> //----- Include Files ---------------------------------------------------------
> #include <avr/io.h>		// include I/O definitions (port names, pin names, etc)
> #include <avr/interrupt.h>	// include interrupt support
> #include <avr/signal.h>
> #include <avr/delay.h>
> 
> 
> unsigned char localBufferLength = 0x20;
> 
> unsigned char dataRead;
> 
> void PrintMenu(void);
> void ProgMain(void);
> 
> //----- Begin Code ------------------------------------------------------------
> 
> int main(void)
> {
> 
> 
> 	//Port A is output
> 	DDRA=0xFF;	
> 	
> 	
> 	//Port A is input
> 	DDRB=0x00;	
> 	PORTB = 0xFF;  //Pullups
> 	
> 	ProgMain();
> 	
> 	return 0;
> }
> 
> 
> void ProgMain(void)
> {
> 	
> 	unsigned char counter = 0;
> 	unsigned char inputButtons;
>  
> 	while(1)
> 	{
> 	
> 		_delay_ms(20);
> 		
> 		inputButtons = PINB;
> 		
> 		
> 		if(counter<255)
> 		{
> 			counter++;
> 		}
> 		else
> 			counter = 0;
> 		
> 	
> 		inputButtons = inputButtons & 0x0F;
> 	
> 		if(inputButtons != 0x0F)
> 		{
> 		
> 			PORTA = inputButtons;
> 		}
> 		else
> 		{
> 			PORTA = ~counter;
> 		}
> 	
> 		
> 			
> 	}
> 		
> 		
> 
> 		
> 
> 	
> 
> 
> }
>

Re: [AVR-Chat] AVR Studio breakpoints

2012-08-19 by John Samperi

At 03:59 PM 19/08/2012, you wrote:
>Below I try to set a breakpoint but AVR Studio moves this breakpoint down:

Try the disassembly view, it may not be "optimised out" but it may
be optimised the way the compiler thinks best.

It's a common thing that happens when you do source level debugging.


Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************

Re: [AVR-Chat] AVR Studio breakpoints

2012-08-19 by David Kelly

On Aug 19, 2012, at 1:44 AM, John Samperi wrote:

> At 03:59 PM 19/08/2012, you wrote:
>> Below I try to set a breakpoint but AVR Studio moves this breakpoint down:
> 
> Try the disassembly view, it may not be "optimised out" but it may
> be optimised the way the compiler thinks best.
> 
> It's a common thing that happens when you do source level debugging.

I've found 4.18 and the older gcc's *much* more precise than the Atmel Studio 6 bundle.

--
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Re: [AVR-Chat] Re: AVR Studio breakpoints

2012-08-19 by bobgardner@aol.com

-----Original Message-----
Show quoted textHide quoted text
From: englsprogeny1 <englsprogeny1@yahoo.com>
To: AVR-Chat <AVR-Chat@yahoogroups.com>
Sent: Sun, Aug 19, 2012 2:14 am
Subject: [AVR-Chat] Re: AVR Studio breakpoints



Note:

I'm using AVR Studio 4.18
I used the wizard to make the project (no external makefiles)

The app does stop at the 'phantom breakpoint' 



--- In AVR-Chat@yahoogroups.com, "englsprogeny1" <englsprogeny1@...> wrote:
>
> As some of you know, I'm migrating to include AVR studio in my projects, 
instead of just what comes with WinAVR
> 
> Below I try to set a breakpoint but AVR Studio moves this breakpoint down:
> 
> 
> I set the breakpoint at the line:  PORTA = inputButtons;
> 
> but AVR Studio moves this breakpoint down to PORTA = ~counter;
> 
> 
> Looking at the code I do not believe that the line that I want to break on is 
optimized out.
> 
> Why is AVR Studio moving my breakpoint?
> 
> Thanks for any input.
> 
> 
> //----- Include Files ---------------------------------------------------------
> #include <avr/io.h>		// include I/O definitions (port names, pin names, etc)
> #include <avr/interrupt.h>	// include interrupt support
> #include <avr/signal.h>
> #include <avr/delay.h>
> 
> 
> unsigned char localBufferLength = 0x20;
> 
> unsigned char dataRead;
> 
> void PrintMenu(void);
> void ProgMain(void);
> 
> //----- Begin Code ------------------------------------------------------------
> 
> int main(void)
> {
> 
> 
> 	//Port A is output
> 	DDRA=0xFF;	
> 	
> 	
> 	//Port A is input
> 	DDRB=0x00;	
> 	PORTB = 0xFF;  //Pullups
> 	
> 	ProgMain();
> 	
> 	return 0;
> }
> 
> 
> void ProgMain(void)
> {
> 	
> 	unsigned char counter = 0;
> 	unsigned char inputButtons;
>  
> 	while(1)
> 	{
> 	
> 		_delay_ms(20);
> 		
> 		inputButtons = PINB;
> 		
> 		
> 		if(counter<255)
> 		{
> 			counter++;
> 		}
> 		else
> 			counter = 0;
> 		
> 	
> 		inputButtons = inputButtons & 0x0F;
> 	
> 		if(inputButtons != 0x0F)
> 		{
> 		
> 			PORTA = inputButtons;
> 		}
> 		else
> 		{
> 			PORTA = ~counter;
> 		}
> 	
> 		
> 			
> 	}
> 		
> 		
> 
> 		
> 
> 	
> 
> 
> }
>




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

Yahoo! Groups Links




 


[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.