Avrstudio 4.19 toolchain using gcc 4.7.x

1.6k views Asked by At

I'm using makefile style compiling of my ATMEGA projects. As legacy of Arduino IDE, develepment toolchain is mostly aimed to gcc 4.3.2. Avrstudio 4.19 + Jtagice MKII CN + gcc 4.3.2 + make works somehow. But my problem is that gcc 4.3.2 is rather buggy. I see e.g. random bugs related to optimization of non-volatile variables, register cached values are not always written back to memory and also wrong warning are annoying. Hence using gcc 4.7.0 solves problem but I cannot load any such a program into Avrstudio 4.19, Avrstudio always crashes when loading hex. Does anybody tried and suceeded with this toolchain ?

Note: I don't want go to higher Avrstudio version because size grows and probably brings new problems.

Thanks

2

There are 2 answers

1
Nigel Winterbottom On BEST ANSWER

The A Erasmus answer may have worked for avr-gcc 4.7.x; but I found in avr-gcc 4.8.1 provided by recent versions of the Atmel AVR Toolchain that AvrStudio4 didn't load any debugging symbols.

I noticed that the .debug-pubnames section was missing from the ELF file generated by avr-gcc 4.8.1 and that using the -gdwarf-2 -gstrict-dwarf -gpubnames debug options reinstated the missing section which then allowed AvrStudio4 to show debugging symbols.

1
A Erasmus On

If one uses the latest avr-gcc toolchain available from Atmel, then AVR Studio 4 crashes when trying to load the .elf file. To fix this change the debug flags from avr-gcc to -gdwarf-2 -gstrict-dwarf. Then one can load and debug programs under AVR Studio 4 as normal.