Author Topic: Atmel Studio C++  (Read 6560 times)

0 Members and 1 Guest are viewing this topic.

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Atmel Studio C++
« on: February 15, 2017, 08:41:28 pm »
I have been working on Atmel Studio for a while, I'm happy with the development environment and probably will buy an Atmel ICE to be able to debug right on the chip. When I install Studio 7, getting familiar with it I read somewhere that C++ was no fully implemented and that classes was one of the things not done.
Now I was reading on the Atmel site that Arduino projects are imported as a C++ project, also read in some forum (which I cannot find it again) a discussion of using classes while programing AVR. Maybe I imagine it. Does anyone have information on this?
 

Offline f1rmb

  • Regular Contributor
  • *
  • Posts: 180
  • Country: fr
Re: Atmel Studio C++
« Reply #1 on: February 15, 2017, 08:47:35 pm »
Hi,

I have been working on Atmel Studio for a while, I'm happy with the development environment and probably will buy an Atmel ICE to be able to debug right on the chip. When I install Studio 7, getting familiar with it I read somewhere that C++ was no fully implemented and that classes was one of the things not done.
Now I was reading on the Atmel site that Arduino projects are imported as a C++ project, also read in some forum (which I cannot find it again) a discussion of using classes while programing AVR. Maybe I imagine it. Does anyone have information on this?

I don't know Atmel Studio, but Arduino framework is C++.

Just checked the homepage, at the bottom you can also read:
"Studio 7 is the preferred IDP for developing and debugging all AVR and Atmel ? SMART applications. It gives you a seamless and easy-to-use environment to write, build and debug your applications written in C/C++ or assembly code."

Cheers.
---
Daniel
 

Offline julianhigginson

  • Frequent Contributor
  • **
  • Posts: 783
  • Country: au
Re: Atmel Studio C++
« Reply #2 on: February 15, 2017, 08:54:31 pm »
just an idea - if you are not working on this professionally, consider a segger edu unit over Sam ice, it's similar price and works with all cortex m parts (though you aren't allowed to use it commercially, while you can use Sam ice commercially)

Sent from my A0001 using Tapatalk

 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: Atmel Studio C++
« Reply #3 on: February 15, 2017, 09:01:27 pm »
Classes are implemented, it is a very basic C++ feature.

You probably heard about STL (Standard Template Library) not being implemented for AVR. This is true.

STL is implemented on ARM to the extent that makes sense.
Alex
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Atmel Studio C++
« Reply #4 on: February 15, 2017, 09:05:18 pm »
Quote
I read somewhere that C++ was no fully implemented and that classes was one of the things not done.
What does "Atmel Studio does not fully implement C++ classes" actually mean?  AS uses avr-g++, which surely supports classes (one of the few C++ features that the Arduino environment actually uses.)   I guess it could mean that some of the IDE functionality (autocompete?) doesn't support classes in some way (?), but that also seems unlikely given that it uses Microsoft Visual Studio, which has supported C++ for quite a while.
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Atmel Studio C++
« Reply #5 on: February 15, 2017, 09:06:44 pm »
Go this idea from this: http://www.atmel.com/webdoc/avrlibcreferencemanual/FAQ_1faq_cplusplus.html

First dotted point:
Quote
•Obviously, none of the C++ related standard functions, classes, and template classes are available.

Maybe this is old?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: Atmel Studio C++
« Reply #6 on: February 15, 2017, 09:08:27 pm »
Maybe this is old?
Nope, this is true. There is no STL in AVR-libc. STL is just too heavy weight for most AVR parts.

On ARM STL is supported.
Alex
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Atmel Studio C++
« Reply #7 on: February 15, 2017, 09:11:26 pm »
just an idea - if you are not working on this professionally, consider a segger edu unit over Sam ice, it's similar price and works with all cortex m parts (though you aren't allowed to use it commercially, while you can use Sam ice commercially)

Sent from my A0001 using Tapatalk

Would it work with Atmel Studio?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: Atmel Studio C++
« Reply #8 on: February 15, 2017, 09:15:02 pm »
Would it work with Atmel Studio?
It will.

But there is no limitation in Atmel-ICE. It is a standard CMSIS-DAP debugger, any tools that know about CMSIS-DAP will work with it. And supported parts depend on the PC tool, not on the debugger itself.
Alex
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Atmel Studio C++
« Reply #9 on: February 15, 2017, 09:20:51 pm »
Maybe this is old?
Nope, this is true. There is no STL in AVR-libc. STL is just too heavy weight for most AVR parts.

On ARM STL is supported.
Sorry I'm old and I get confused pretty quickly. STL is the standard library correct? I understand that classes are implemented on the STL, i'm wrong? , so can I implement classes to use when programing a avr, let say a Atmega328?

Sorry to look so stupid.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: Atmel Studio C++
« Reply #10 on: February 15, 2017, 09:26:47 pm »
Sorry I'm old and I get confused pretty quickly. STL is the standard library correct? I understand that classes are implemented on the STL, i'm wrong?

STL is this https://en.wikipedia.org/wiki/Standard_Template_Library

It is a library that contains standard implementations of smart arrays, vectors, sorting algorithms, and all that stuff.

Typically implementations are heavy weight  and use dynamic memory allocation (malloc). None of this is suitable for typical AVR memory sizes.

You can make your own classes, this is not a problem at all.
Alex
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Atmel Studio C++
« Reply #11 on: February 15, 2017, 10:08:32 pm »
Thanks, I'll try it this evening. So you are going to tell me that I have been suffering not using classes, because I read the wrong thing  :palm:

ataradov , I really appreciate your patience.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: Atmel Studio C++
« Reply #12 on: February 15, 2017, 10:11:04 pm »
So you are going to tell me that I have been suffering not using classes, because I read the wrong thing
I would say so. The whole Arduino thing is C++ with classes, and it works fine.
Alex
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1477
  • Country: gb
Re: Atmel Studio C++
« Reply #13 on: February 15, 2017, 10:20:32 pm »
I guess it could mean that some of the IDE functionality (autocompete?) doesn't support classes in some way (?), but that also seems unlikely given that it uses Microsoft Visual Studio, which has supported C++ for quite a while.

It does indeed support auto-complete for C++ classes.

All the auto-complete, code snippet, refactoring, enhanced syntax highlighting, etc. is actually all provided by the 3rd-party Visual Assist add-in. Although AS is based on Visual Studio, because it's not using Microsoft's compiler, you don't actually get any of the usual Intellisense features, hence why Atmel had to bundle an add-in that provides that kind of stuff. In my opinion, Visual Assist isn't that great. It has limited code-formatting customisation, some annoyances in behaviour, and once or twice I have had it's 'rename' auto-refactoring feature mess up my code. >:(
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Atmel Studio C++
« Reply #14 on: February 15, 2017, 10:25:46 pm »
I just try it, indeed it works  :palm:.
Thanks everyone again.
 
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Atmel Studio C++
« Reply #15 on: February 15, 2017, 10:41:36 pm »
Code: [Select]STL is the standard library correct? I understand that classes are implemented on the STL? "Classes" are a language feature, and are supported by avr-g++ and AS.
The STL is a set of *Standardized* classes implemented on top of the language itself.  The usual STL makes heavy use of dynamic allocation (frequently not a good idea on small-RAM microcontrollers) and exception trapping (not implemented, perhaps not implementable, for AVR), so it's NOT present.

The most obvious example is "Strings" - the STL (or is String considered part of libstdc++, rather than STL) implementation of Strings will let you do things like "S += 'a';" that will go and say "There isn't enough space in S to add another character, so I'll go realloc a new copy of S that has a bunch more space."   So ... avr-g++ does not support Standard C++ Strings.   But it supports enough that you can write your OWN C++ class to handle strings...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf