Using AVR studio with an arduino sketch.

So I just recently finished a standalone pcb utilizing the atmega1280 chip. I have wrote all the code in the arduino IDE. I would like to be able to use the existing code I have written and upload it through AVR studio 4. Last night I uploaded the *.hex file in avr studio that was generated in the arduino IDE but nothing seemed to work correctly. The atmega1280 of course has no bootloader, but from what i’ve read as long as your using the MKII you shouldn’t need the bootloader. The hex file that I uploaded programmed fine but nothing was working correctly. There’s an lcd, buttons, buzzers, mosfets… all that jazz. So I decided to try the bootloader. I used the atmega1280 bootloader supplied with the arduino IDE files, but it bricked the chip (Changed the fuse settings) - probably from my lack of experience. The only way to recover would be to use a HVPP I suppose.

I’m going to build another board today, but i don’t want a repeat of last night. Will the hex file work without the bootloader, I see in avrstudio all the pins are mapped using a different method, not using the pinMode(53, OUTPUT); could this be what the bootloader assists with or is the bootloader just for say using a USB instead of a programmer like the MKII.

I have done lots of research but no straight forward answers that I can find. Any help is greatly Appreciated.

Also whats the *.ELF file smiley-sad

Thanks a bunch

Geoff

I was just wondering, did you have any luck with getting this to work? I am having the same issue…

you may wish to “upgrade” from Auduino and its canned libraries to Atmel’s AVR studio 4.x with WinAVR, and setup that for doing C++ (or use vanilla C which is easier).

The result of the WinAVR project is a .hex file, much like Arduino does (but hides). The can be put into the flash of the target AVR chip using the ISP programmer (MK-II) - quite easy and is the “usual” way to do so. The use of a serial bootloader is normally done for field upgrades where the development system isn’t available, i.e., sending code to multiple sites in the field. Arduino uses the serial bootloader to reduce cost and to simplify.

The guys on AVRfreaks.net will help you get started with WinAVR, and there are lots of tutorials.

Soon there will be a version 5 of AVRstudio which uses Microsoft’s Studio as the “IDE” (editor, project management etc.) - but for AVRs as the target. It’s in beta form now.

Thanks very much. I do have AVR Studio 5 beta. The reason I am trying to use the bootloader is for exactly the reason you said. I need to be able to ship code updates for people to install.

Beware AVR Studio 5 is in early beta - incomplete, buggy.

I’ve been using AVR studio 5 (beta 1 and 2) with great success. It has crashed on me once or twice, but that could just be my laptop, since I’m using a 6 year old laptop that hasn’t been formated in 4 years.

Anyways, I did write a tutorial on how to use AVR studios with the Arduino. Hope this helps: [<LINK_TEXT text=“http://sites.google.com/site/qeewiki/bo … r-software”>http://sites.google.com/site/qeewiki/books/avr-guide/getting-started-with-avr-software</LINK_TEXT>.

Cheers

Q](http://sites.google.com/site/qeewiki/books/avr-guide/getting-started-with-avr-software)

That’s great, thanks!