AVR Studio 5 & C++

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

I tried porting an existing C++ project from AVRStdui32 to AVR Studio 5 and it does not seem to recognize or compile the .cpp C++ files. Is there an option I didn't see or does the new environment simply not support C++?

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

I managed to compile .cpp files by using external Makefile (Project => project_nameProperties => Build => Use External Makefile).

In the Makefile, I specifies the flags, build, and compile rules for each files I use in the project. I can also specifies which compiler I want to use(e.g. avr-gcc; avr-c++, etc.)

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

With Visual Studio all the facilities are there to build professional C++ applications. Why don't Atmel make use of these powerful features. I've been using C++ OOP for years on a 8-bit processor (80188) in a critical environment and it works very reliable. It seems to me that getting C++ to work might only be a matter of making Visual recognize .cpp files and compiling them with avr-c++.

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

i'm not really into trying to tweak tools or manage makefiles as i am into the perfection of the application itself which i am trying to develop. until they support c++ out of the box i am moving to the atollic tools which seem to work very well and are trivial to migrate avrstudio32 projects to since they are both using the same old eclipse and atmel plug-ins. my real hope is that atollic does something more with their environment before studio5 learns c++.

so far atollic support has been very good and the price isn't anywhere near as bad as iar. they also use the same gcc toolchain so no code changes were required. plug and play.

i am just glad atmel handed this development over to atollic instead of just dropping it completely.

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

I had the same problem, and here is what I did to get it to work without an external makefile.

Problems:
1) For whatever reason, there is no way that I have found to simply ask Studio5 to use g++ instead of gcc.

2) If your files end in anything except ".c", the studio5 toolchain will not emit any of the options that you ask for for the compiler.

Solution:

1) Rename your '.cpp' files to end in '.c'.

2) Go to your project/properties

3) Under Toolchain/"AVR GNU C Compiler"/Miscellaneous, add the following to the "other flags":

-x c++ -std=gnu++98

The -x c++ tells the basic C compiler to treat the source as C++, regardless of the file extension. I don't think you need the -std option, but by specifying it, you are guaranteed to get the gnu C++ default behavior.

That did the trick for me. Now my C++ project builds and links just fine.

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

I just found something interesting:
Start AVRStudio5, click on Tools->Extension Manager->Online Gallery

And you will find a "AVRGCC C++ (beta)" entry. After installing and restarting the Studio, you can create C++ Projects.

Student at the University of Applied Sciences Ulm, Germany

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

Can you confirm it runs flawless? Even with debuging?

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

So far I can see yes. Working on a ATmega64 with mk2-clone. Not testet with dynamic objects. Just using classes with static methods at the moment.

I really like it!

Student at the University of Applied Sciences Ulm, Germany

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

t0mmy wrote:
I just found something interesting:
Start AVRStudio5, click on Tools->Extension Manager->Online Gallery

And you will find a "AVRGCC C++ (beta)" entry. After installing and restarting the Studio, you can create C++ Projects.

I couldn't find this in AVR studio 5.1.

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

Quote:

I couldn't find this in AVR studio 5.1.

As I said elsewhere ditch 5.1 as it's dead and buried and get AS6 which natively supports C++ (as the example I posted proves).

EDIT: here...

https://www.avrfreaks.net/index.p...

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

Really? IS AS6 the heir apparent to AS5.1? I thought they were going to keep the two separate. Anyway, I HAD S6 on my computer running win 7 64 bit and all it did was cause the computer to freeze up and croak until I got rid of it! I figured I'd wait until the damn thing was out of beta before trying it again.

EDIT: I just looked at Atmel's web site. Seems AS6 IS now in production release! OK, I guess I should try it. Should I first UN-install AD 5.1? The LAST time I tried S6 it appeared that the two used common dll's and screwed each other up.

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

Ah but are you talking about the still buggy first release of AS6 or the thing released in the last week that, on the surface, is starting to look pretty good?

And yes AS6 is the development path now - AS5 was just a stepping stone. And yes this probably does mean you are going to download about 200M of ARM support you may never ues - but you were already downloading about 200M of UC3 support you were never going to use either ;-) (apparently ADSL bandwidth and HDD space cost nothing these days).

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

clawson wrote:
Ah but are you talking about the still buggy first release of AS6 or the thing released in the last week that, on the surface, is starting to look pretty good?

And yes AS6 is the development path now - AS5 was just a stepping stone. And yes this probably does mean you are going to download about 200M of ARM support you may never ues - but you were already downloading about 200M of UC3 support you were never going to use either ;-) (apparently ADSL bandwidth and HDD space cost nothing these days).

Well actually I was hoping to use S6 for Arm developement, but NOT the SAM3 family, but rather the SAM7/9 families which are not (yet) included.

Should I remove S5.1 first before installing S6?

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

Quote:

Should I remove S5.1 first before installing S6?

I did but the release notes say they can co-exist if you want.

BTW don't make the mistake I made and expect to be able to install it on a network drive.

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

Hmmm I checked further on Atmel's site and it appears that AVR studio 4 AND AVR studio 5 have BOTH disappeared!
http://www.atmel.com/products/mi...

The old avr studio 32 is STILL listed however!

Actually the older versions are listed under the 'archive' link. By the message is clear, they are pushing 6 now.

What sucks is that studio 4 could run under Linux with wine, though you might not be able to control the jtag from within S4 under wine.

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

Quote:

What sucks is that studio 4 could run under Linux with wine,

Yes it's undeniiable that sucks but when you hitch your cart to the Redmond pony I guess you cannot expect much else. Microsoft aren't going to make it easy to run their software in a non Windows environment.

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

Well I didn't hitch that pony up, Atmel did. Guess they forgot where their compiler and assemblers came from. They should at least open up the protocols for the Jtag3 and AVRone to return the favor.

Anyway, just un-installed AS5.1 and AS6 is installing now. Note that the name changed to Atmel Studio 6, not AVR. Wonder if they will bundle in their 8051 products too.

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

Quote:

They should at least open up the protocols for the Jtag3 and AVRone to return the favor.

While I don't think we have a spec document to release, you can actually sniff the communication protocol pretty easily between the front and back-ends, since it's all done through a local TCP/IP connection. It uses a slight variant of the Eclipse TCF protocol (http://wiki.eclipse.org/DSDP/TM/...).

Quote:

Actually the older versions are listed under the 'archive' link. By the message is clear, they are pushing 6 now.

They are no longer actively pushed, because they are no longer being developed. AS6 and onwards is the way new users should go, but as you've seen the archive link should at least give you a place to download old versions if you need it.

Quote:

Really? IS AS6 the heir apparent to AS5.1? I thought they were going to keep the two separate. Anyway, I HAD S6 on my computer running win 7 64 bit and all it did was cause the computer to freeze up and croak until I got rid of it!

Studio 6 isn't fundamentally different from AS5.1 (or 5.0) thus it should behave quite similarly. In the beta it was slow to start due to a bug, but that should be fixed in the release version.

Quote:

And yes this probably does mean you are going to download about 200M of ARM support you may never ues - but you were already downloading about 200M of UC3 support you were never going to use either Wink (apparently ADSL bandwidth and HDD space cost nothing these days).

I don't know what the plans of the tools team are, but they are aware that everyone wants to be able to select components "a la carte" - I know it's in the backlog as a possible future feature. ASF has already transitioned to a fully separate module, thus it can be easily replaced or (theoretically) downloaded post install.

On this note you should be happy Cliff - I'm currently working on transitioning some components inside ASF which should approximately halve the total size of the repository. That will at least mean smaller downloads and installs in the future by about 100MB or so.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Quote:

That will at least mean smaller downloads and installs in the future by about 100MB or so.

The 3.5MB I get across my ADSL is not so bad but I pity people in developing countries who may still be making a 56K modem link to the internet. They seem to be completely forgotten these days by content producers.

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

Quote:

The 3.5MB I get across my ADSL is not so bad but I pity people in developing countries who may still be making a 56K modem link to the internet. They seem to be completely forgotten these days by content producers.

Indeed, it's a pickle. The best I can do on my end is to complete this patch to greatly reduce size of ASF when installed, and continue to press tools to allow users to select what they want to download up-front.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

abcminiuser wrote:
Quote:

The 3.5MB I get across my ADSL is not so bad but I pity people in developing countries who may still be making a 56K modem link to the internet. They seem to be completely forgotten these days by content producers.

Indeed, it's a pickle. The best I can do on my end is to complete this patch to greatly reduce size of ASF when installed, and continue to press tools to allow users to select what they want to download up-front.

- Dean :twisted:

Well Ateml could bundle up the latest tools, appnotes and datasheets and package them on a CDrom or DVDrom to ship out to those bandwidth deprived customers. I realize that keeping such disks up to date might be a challenge. I just bought a brand new AVRispmkII from Mouser (I think they move their stock quickly) and it came with a CD from 2009-10! Actually the box had a 2010 serial number on it, is Atmel still shipping AVRispmkII's made TWO years ago?