AVR Studio stops working, when "start debugging" a

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

I load my program; do "Rebuild All"; program "Flash" with its .hex file (board operates properly), then I open "Debug" tab and select "Start Programming". This starts (at the bottom of the screen) a green line going across, then the AVRStudio MFC Application "pop-up" window appears (in the center of the screen) displaying: AVRStudio MFC Application has stopped working.
A problem caused the program to stop working correctly.
Windows will close the program and notify if a solution is available.

Could someone help me with ideas on how to fix this problem?

Thanks, Ron

P.S. I have other (smaller) programs where debugger worked fine! This one has 410 bytes of data (5% Full).

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

Why are you doing all of this messing around? Once you have built your code and you know there are no errors just do either a "Start Debugging" or simply another "Build and Run" and everything is done for you.

Quote:
I open "Debug" tab and select "Start Programming".
You mean "Start Debugging"?

By the way which debugger are you using? (Dragon, JTAG ice) And which chip? Are you using JTAG, PDI or DW?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Which version 4.x of AVR Studio?
Which Windows version?

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

And which toolchain ?

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

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

ron_younkin wrote:
I load my program; do "Rebuild All"; program "Flash" with its .hex file (board operates properly), then I open "Debug" tab and select "Start Programming". This starts (at the bottom of the screen) a green line going across, then the AVRStudio MFC Application "pop-up" window appears (in the center of the screen) displaying: AVRStudio MFC Application has stopped working.
A problem caused the program to stop working correctly.
Windows will close the program and notify if a solution is available.

Could someone help me with ideas on how to fix this problem?

Thanks, Ron

P.S. I have other (smaller) programs where debugger worked fine! This one has 410 bytes of data (5% Full).

I have the same problem!When select "Start Programming",then display this error :AVRStudio MFC Application has stopped working.

No other people have this problem?
Pls give me advice! Tks!

Version:
Studio 4.13 + WinAvr 20100110 +simulation Debug

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

Quote:
Studio 4.13 + WinAvr 20100110
That's a very old version of Studio, try one of the latest/last versions like 4.18 or 4.19

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I had similar problems in 4.18.

This was a pain since the current Studio at that time was AVR Studio 5 - and we all know how bad that was.

Since Atmel Studio 6 has been a much better effort from Atmels side, I've had no reason to run AS4 for quite some time now.

I speculate that the problem I experienced with AS4 was a bug/compatibility/API-usage matter with respect to MFC.

One thing is most definitively sure, unless you are a customer that drives half of Atmels sales or so :wink: : There will be no maintenance on AS4.

Any possible solution will be by tinkering with your system, trying different MFC DLLs etc.. I personally have neither the interest nor the energy to dive into that, but if you want someone here to try to help you you should post as much information possible about your system. OS version, versions of important DLLs (e.g. the MFC DLL) etc..

HTH!

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

I have a similar problem. I Build the project and Start Debugging than... puff!
Until yesterday this worked great!

The strange thing is that the erase/programming/verifying it's ok, only debugging will crash.

My configuration:
- Virtual Windows XP OS SP2
- AS 4.19
- RS232-only JTAGICE clone
- AVR8 Toolchain for Windows 3.4.2

I can't use AS6 because I have this old RS232-only debugger. I'm going to purchase a new USB programmer/debugger, but at the moment I have no money for that :-(

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

Please do not cross post, it's better if you continue in your original post
https://www.avrfreaks.net/index.p...

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I'm sorry, but I think AS4 crashes problem is a different question than the possibility to use AS6 with my old JTAG debugger.

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

Quote:

Until yesterday this worked great!

Since this is a virtual machine, are you in the habit of making snapshots of it? If so, then what happens if you return to an earlier snapshot?

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

Unfortunately I don't have the habit to make snapshots.

I just upgraded Windows XP from SP2 to SP3, but the problem occurs again :-(

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

I found something! If I configure the project with -O0 optimization level, the crash doesnt' appear.

As soon as I set -O1, the crash is shown.

Should I disable the optimization?

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

Quote:
Should I disable the optimization?
No, if anything use -Os and find why you code is being optimised out.

Have you looked at the .lss file to see what is being generated with -O1? Maybe nothing or it doesn't compile correctly, post your code if you can.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:
No, if anything use -Os and find why you code is being optimised out.

Have you looked at the .lss file to see what is being generated with -O1? Maybe nothing or it doesn't compile correctly, post your code if you can.


Thanks js for your suggestions. The crash disappears only if I disable the optimization (-O0), otherwise it happens for whatever level (-O1, -O2, -O3, -Os).

Now the crash seems not related to the code. Even if it is very simple, AS4 crashes. For example:

volatile unsigned char xxx;

int
main(void)
{
	while(!++xxx)
		;
}

The compilation with -Os ends without any error/warning. The .lss file is generated and seems good. Here it is the interesting part:

0000008c <__ctors_end>:
  8c:	11 24       	eor	r1, r1
  8e:	1f be       	out	0x3f, r1	; 63
  90:	cf ef       	ldi	r28, 0xFF	; 255
  92:	d0 e1       	ldi	r29, 0x10	; 16
  94:	de bf       	out	0x3e, r29	; 62
  96:	cd bf       	out	0x3d, r28	; 61

00000098 <__do_clear_bss>:
  98:	21 e0       	ldi	r18, 0x01	; 1
  9a:	a0 e0       	ldi	r26, 0x00	; 0
  9c:	b1 e0       	ldi	r27, 0x01	; 1
  9e:	01 c0       	rjmp	.+2      	; 0xa2 <.do_clear_bss_start>

000000a0 <.do_clear_bss_loop>:
  a0:	1d 92       	st	X+, r1

000000a2 <.do_clear_bss_start>:
  a2:	a1 30       	cpi	r26, 0x01	; 1
  a4:	b2 07       	cpc	r27, r18
  a6:	e1 f7       	brne	.-8      	; 0xa0 <.do_clear_bss_loop>
  a8:	0e 94 5a 00 	call	0xb4	; 0xb4 
ac: 0c 94 64 00 jmp 0xc8 ; 0xc8 <_exit> 000000b0 <__bad_interrupt>: b0: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> 000000b4
: volatile unsigned char xxx; int main(void) { while(!++xxx) b4: 80 91 00 01 lds r24, 0x0100 b8: 8f 5f subi r24, 0xFF ; 255 ba: 80 93 00 01 sts 0x0100, r24 be: 88 23 and r24, r24 c0: c9 f3 breq .-14 ; 0xb4
; } c2: 80 e0 ldi r24, 0x00 ; 0 c4: 90 e0 ldi r25, 0x00 ; 0 c6: 08 95 ret 000000c8 <_exit>: c8: f8 94 cli 000000ca <__stop_program>: ca: ff cf rjmp .-2 ; 0xca <__stop_program>

And here it is the .lss with -O0:

0000008c <__ctors_end>:
  8c:	11 24       	eor	r1, r1
  8e:	1f be       	out	0x3f, r1	; 63
  90:	cf ef       	ldi	r28, 0xFF	; 255
  92:	d0 e1       	ldi	r29, 0x10	; 16
  94:	de bf       	out	0x3e, r29	; 62
  96:	cd bf       	out	0x3d, r28	; 61

00000098 <__do_clear_bss>:
  98:	21 e0       	ldi	r18, 0x01	; 1
  9a:	a0 e0       	ldi	r26, 0x00	; 0
  9c:	b1 e0       	ldi	r27, 0x01	; 1
  9e:	01 c0       	rjmp	.+2      	; 0xa2 <.do_clear_bss_start>

000000a0 <.do_clear_bss_loop>:
  a0:	1d 92       	st	X+, r1

000000a2 <.do_clear_bss_start>:
  a2:	a1 30       	cpi	r26, 0x01	; 1
  a4:	b2 07       	cpc	r27, r18
  a6:	e1 f7       	brne	.-8      	; 0xa0 <.do_clear_bss_loop>
  a8:	0e 94 5a 00 	call	0xb4	; 0xb4 
ac: 0c 94 6b 00 jmp 0xd6 ; 0xd6 <_exit> 000000b0 <__bad_interrupt>: b0: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> 000000b4
: volatile unsigned char xxx; int main(void) { b4: cf 93 push r28 b6: df 93 push r29 b8: cd b7 in r28, 0x3d ; 61 ba: de b7 in r29, 0x3e ; 62 while(!++xxx) bc: 00 00 nop be: 80 91 00 01 lds r24, 0x0100 c2: 8f 5f subi r24, 0xFF ; 255 c4: 80 93 00 01 sts 0x0100, r24 c8: 88 23 and r24, r24 ca: c9 f3 breq .-14 ; 0xbe cc: 80 e0 ldi r24, 0x00 ; 0 ce: 90 e0 ldi r25, 0x00 ; 0 ; } d0: df 91 pop r29 d2: cf 91 pop r28 d4: 08 95 ret 000000d6 <_exit>: d6: f8 94 cli 000000d8 <__stop_program>: d8: ff cf rjmp .-2 ; 0xd8 <__stop_program>

In the -Os version, the first 4 instructions aren't generated, but I don't know if they are the cause of the crash.

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

Just to be sure, do you have the io.h file included? (not shown above)

Is the project setup for the correct chip?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:
Just to be sure, do you have the io.h file included? (not shown above)

That simple program doesn't need file. Anyway I tried to include it and the .hex file generate is the same. And Studio crashes as usual during debugging :-(

Quote:
Is the project setup for the correct chip?

I'm using ATMega16A and it is correctly configured in the project options. The JTAG ICE knows only ATMega16 that should be identical. I tried to use ATMega16 in the configuration options, but nothing changed.

I also tried to reinstall AVR Studio 4, to run it as administrator and use the native Windows 7 64bit operating system (at first I was using Windows XP under a virtual machine), but AS4 always crashes.

Is the serial RS232 protocol of JATG ICE known? I could try to sniffer RS232 traffic to understand what happens.

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

Quote:
than... puff!

Quote:
AS4 crashes problem

Quote:
the crash doesnt' appear.

Quote:
Studio crashes as usual during debugging

I'm still eager to here what a "crash" actually means. Do you mean avrstudio.exe causes a windows blue screen of death or that it throws an exception error and exits or are you simply saying that the debugging does not behave as you expected? If so what were you expecting and what happens?

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

Quote:
That simple program doesn't need file
I'm not a C expert but I would think that without that file the compiler would not know where things like the flash or ram start and end for that chip...but I could be wrong. :-)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:

but I could be wrong.

I'm afraid you are. It's when you pass -mmcu= to the compiler/linker that they find out that kind of detail. Some of it is built intoba lookup table in the tools and some of it comes from which crt.o and lib.a files the linker then chooses to link with.

The io.h stuff is just there for the benefit of you the programmer. If you don't use anything defined in io.h then you don't need to include it.

(this is different to the Atmel assembler and def.inc files).

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

Yep, I run the code above earlier today. It doesn't do much just increments xxx once and then it stops as it should. (simulator)

Don't have a chip to try it on with the JTAG Mk1 unfortunately.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:
...or that it throws an exception error and exits...

This is my situation. The exception error refers to MFC (I think Microsoft Foundation Classes libraries).

I'll try later with the simulator. Perhaphs I could understand what's the problem with the debugger.

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

Quote:

This is my situation.

Did you read Johan's post above:

https://www.avrfreaks.net/index.p...

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

clawson wrote:
id you read Johan's post above:

I already checked what is in my capabilities, but nothing.

I have also tried with the simulator and even in this case AS4 crashes!!!

I'm thinking my avr-gcc is creating a wrong/bad .elf output file for debug (.hex file is correct).
Indeed when I remove -gdwarf-2 option from compilation command line, I can debug without problems, but I can see only assembler and not C code.

I tried with -gstabs, no crash, but always assembler and not C code. Anyway I think -gdwarf-2 is the correct option to use. Should I use some other compilation option on the command line?

Could my avr-gcc (gcc 4.7.2, toolchain 3.4.2_939 for Windows) bugged in creating debugging info?

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

I used AS4.18 SP3 using winAvr20100110 with your simple code above without problems, I simply allowed Studio to do it's thing without interference from me. Just set the clock in the project configuration (not really needed I guess), nothing else.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Studio 4.19 Simulator/Simulator 2 crashes on binaries built with AVR Toolchain v.3.4.0 and above.

The latest known good Toolchain version whose output doesn't cause the simulator to choke is [url=http://www.atmel.com/Images/avr-toolchain-installer-3.3.1.1020-win32.win....

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

Why would Atmel care? Studio 4 is no longer maintained. Atmel switched their effort to Studio 5 then 6 several years ago. So the solution seems simple: use Studio 6.2 not 4.

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

I'm troubleshooting a separate unrelated issue, thus giving 4.19 a try.

BTW, both generations, 4 and 6, are awful in their own special ways :(

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

Quote:

BTW, both generations, 4 and 6, are awful in their own special ways

Then why are you using either of them? :roll:

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

I was troubleshooting an issue and looking if it would spring up on older toolcahain (it didn't), and posted a solution for other lost souls trying to beat a dead horse.

Got back to 6.2, for one more minute, if you know what I mean.

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

Hi all
I use AVR Studio 4.19
Gcc compller+make "AVR8 GCC" from Studio 6.1
And china "AVR GTAG ICE"

Afer pressing "Start debugging" studio crash.

You need to add two option "Project"->"Configuration option"->"Custom options"
-gdwarf-2
-gstrict-dwarf

After rebuild project debugging work!