Release vs. Debug in Atmel Studio 6.2

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

Hi guys,

 

I have a bug which is present when I build with Release but goes away with Debug. (AT32UC3A3, FreeRTOS 6.0.0) I suspect the bug has to do with timing issues around USB init.

 

Question: what is the difference between a Release build and a Debug build in Atmel Studio? Knowing this I may be able to find out where in the code the bug strikes.

 

 

Thanks,

Borge

 

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

Compare the compiler/linker switches in Project -> xxxx properties -> Toolchain
The most signirficant difference is that in Debug mode the optimisation is set to -O1 (Optimize) and in Release mode it is -Os (Optimize for size)
You can experiment with the other optimisation levels (-O0, -O2 -O3) and see what code is produced (in the .LSS file)

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

Often when optimized code doesn't work but unoptimized (or lower optimized) does it's because you are relying on something that is volatile that you have not specifically added the volatile keyword too. Anything that is shared between paths of execution (which usually means mina() and some interrupt) needs to be "volatile". It might also be something to do with atomicity that is highlighted by the more efficient code.