If you want to change the default toolchain used in atmel studio 6 or avr studio 5.1 please refer this post. For studio 5 please continue reading.
From the main menu, choose Tools -> Options and navigate to the screen showed below.
You can then click on the ellipsis (…) buttons to change the GCC toolchain folder path. The path that you select must contain the appropriate compiler executable (avr-gcc/avr32-gcc). On my machine, for example, to change my 8-bit toolchain to WinAVR, I select C:\WinAVR-20081118rc2\bin.
You can always go back to the default GCC toolchain by clicking the “Restore Default” button.