Later version of avr-gcc produces non working code

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

Me and my colleague just discovered that when he compiled our project, some features no longer worked on the target.

We nailed it down to avr-gcc.exe, which were different versions. Mine had date 2007-12-21 and size 215040 bytes and works fine.

His version was downloaded last week.

They create different sized code and as mentioned, the later one is not working.

I don't really know what to do here. I'd really like to use the latest versions of everything, but it's scary that the compiled code is no longer working.

Regards

/Bo

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

Most often the reason is an forgotten volatile. Newer versions with its more aggressive optimizations then reveal your error.

Quote:
I don't really know what to do here. I'd really like to use the latest versions of everything, but it's scary that the compiled code is no longer working.
Search and eliminate the error in your code.

Stefan Ernst

Last Edited: Thu. Sep 3, 2009 - 08:03 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is of course quite possible that you have some program syntax that gets translated differently. The generated code may well differ but the logical flow should be identical.

It is far more likely that your source code differs or that the Makefile / Studio project file differs.

If you have a genuine problem you need to isolate it into something reproducible for a bug report.

David.

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

Also you should be able to track where behaviour differs either by a static analysis of the side-by-side .lss files or a dynamic analysis of what the code is actually doing in either the simulator or (better) the on chip debugger.

Cliff

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

At this stage I don't have time to look for the exact reason for this behaviour. But I just read in clawson's footnote that Optimization -O0 should never be used with avr-gcc, which we have been using.

I'll look further into it when time permits.

Thanks all!

/Bo

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

MrMayhem wrote:
I'll look further into it when time permits.
When you come back, be sure to read Help, My "..." Doesn't Work! for clues on getting better answers to your questions.

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

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

Will do, Stu! Thanks for the help!