I have a couple of questions regarding atmel studio 7 and arduino sketches.
I realise this may have been asked before so I apologise if it has.
So I came across some information on the atmel website saying that it can be used to upload and debug arduino sketches this sounds like it could be quite useful, I understand how to load the sketch, upload it and how to use the debug interface.
So the questions:
I understand this does not use the bootloader it loads the code directly into the micro controller:
is this a more efficient method of loading the code?
is the complied code any better / worse than the arduino compiled code?
Without the bootloader does the MCU start executing the code quicker / faster MCU start-up time?
These are just some general questions that came to me and thought it would be quite interesting.
If you have a Programmer, you connect it to the ICSP header and in the IDE select File:Upload Using Programmer to load the code direct to memory. This overwrites the bootloader. After a Reset, your sketch then immediately starts.
You do not need Atmel Studio for that.
As for the compiler, I don't what compiler Atmel Studio uses. I believe IDE 1.8.1 uses avr-gcc-4.9.2.exe.
You can browse the Atmel Studio files for avr-gcc and see if it calls out the same.
I have a few programmers for Atmel products so uploading VIA ISCP isn't a problem. I actually quite like Atmel Studio 7.
I've not touched AVR's or Arduino for quite a while now was just thinking of getting back into it, I just thought it was interesting that it could now compile and upload Arduino sketches and those were the questions that came to mind.
had a look in the projects properties options and it is GCC compiler.
I understand this does not use the bootloader it loads the code directly into the micro controller:
is this a more efficient method of loading the code?
You save the 512bytes of flash used by the bootloader. Programming can be faster or slower depending on which device programmer you use and what it uses for communications protocol. (There have been reports that bootloader at 2Mbps can be faster than full-speed SPI ISP on the same chip, because SPI maxes out at 4Mbps and uses multiple bytes per byte of data. But in general, I think you're unlikely to see significant changes in upload time.)
is the complied code any better / worse than the arduino compiled code?
They use the same compiler, roughly speaking. (avr-gcc 4.9.x+)
It's possible to write code that does things better than the Arduino libraries, but "Will my digitalWrite() be faster or slower than the Arduino's digitalWrite() is a hard question to answer." When you tell AS to build an Arduino project, it uses the same libraries that Arduino would use.
Without the bootloader does the MCU start executing the code quicker / faster MCU start-up time?
Yes. The bootloader runs about 1.5s after RESET before starting your sketch. (It might or might not after power-on; it depends on how the internal RESET flags get set by the chip.) That's 3 LED flashes and one second of waiting for serial bootloader traffic that won't be there. This also increases the flexibility of pin13 usage - you could use it for things that wouldn't like the start flashes.
zx81:
I was not aware of that! Thanks for pointing that out..l will take a look at that.
Its really good, it allows you to use but retain the original arduino sketch so you can always open ,modify and run it back in the arduino ide if you wish.
Its code editing features are what you would hope for and for larger project its a pleasure to use.
You still have things like Serial Monitor available plus all the potential of Studios debugger, though have never used it yet.
Some good lengthy Ytubes on how to use the features of Studio with VM.
Be aware Studio7 is a massive and lengthy download / install.