3

I am using Arduino IDE to program my ATmegas with bootloaders. I can directly manipulate ports, use timers, interrupts, PWM pins and timers, etc. Everything is working.

But this question arises: Does the Arduino IDE differ from AVR Studio in terms of using C or C++ on an ATmega chip?

I know AVR Studio has some features or something. My question is not about that. My question is that I am coding everything, not using extra libraries, features etc.

2 Answers 2

11

In terms of the core language features, there's virtually no difference. In the background, the Arduino IDE and Atmel/AVR Studio both use GCC to compile the code.

GCC is an excellent toolset which supports all the core language features of C++. Admittedly, the version which currently comes with the Arduino IDE is a little old, so it doesn't support C++11 onwards. However, a lot of C++11 features are not very relevant or useful for microcontroller programming anyway (e.g. threading).

You're also likely to use the same standard library for both, which is AVR Libc. It provides pretty much all the standard C functionality that you're likely to use in an AVR project. It doesn't include the C++ stuff though, such as streams, containers, and algorithms. These tend to be very resource-hungry though, so are best avoided anyway.

The major difference is basically flexibility. Atmel/AVR Studio is designed to let you work on a wide range of projects and customize the build to suit very specific needs. You can also use alternative libraries with it more easily. In theory, the Arduino IDE can be modified in similar ways, but it's a major hassle because it provides no GUI to do it.

It's also important to note that the Arduino IDE does a number of non-standard things, such as re-organising declarations and including libraries in strange ways. It's designed to be more user-friendly, but often ends up just getting in the way. There are usually ways to work around those issues though.

1
  • I absolutely got the point. I got the answer I am looking for. Thank you.
    – Zgrkpnr__
    Commented Jan 28, 2015 at 11:04
-1

It is unclear exactly what you are asking. The Arduino is different to most computers - it has NO OS (if you exclude the bootloader).

You can use a c/c++ compiler which translates your code to machine code. If you include libraries this may include machine code which someone else has compiled into a library.

You could write 100% of your code in assembler and produce exactly the same result. Even in the good (bad?) old days of the 1970s before we had compilers on microprocessors it was common to have prewritten code (libraries) for common functions.

You haven't lived until you have written your own assembler (hand coded).

3
  • For my type of projects, assembly would be too complicated.
    – Zgrkpnr__
    Commented Jan 28, 2015 at 12:34
  • 4
    @milliways - I've written only parts of a hand coded assembler (never finished), BUT I started programming in machine language on a 6800 (6802 mostly). ie no assembler - write mnemonics, compile "in head", hand calculate relative branches, key in code from hand drawn listing with hex keypad (occasionally binary switches). Creed 7B baudot printer "after a while". I submit for your valued consideration that that qualifies as "having lived" in this context :-). No?. [As you might expect, I recently had my 1,000,000 th birthday]. Commented Jan 28, 2015 at 13:18
  • 2
    1,000,000th birthday in binary isn't that old :)
    – Omer
    Commented Jan 28, 2015 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.