Best C/C++ library for AVR

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

Please least best C/C++ libraries that are more familiar and should be able to program all inbuilt modules of AVR along with external modules.

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

Arduino

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

+1 for Arduino but after that
.
Fleury
Stang
Martin Thomas

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

I feel I should point out:

 

A lot of Arduino code is actually really bad. There's some questionable design choices there, which can result in stuff being orders of magnitude slower than it has any reason to be, and a lot of the libraries for it have atrocious performance with regards to memory or speed. That said, it's also pretty easy to get started with and a whole lot of stuff supports it.

 

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

avr-libc has very nice features https://www.nongnu.org/avr-libc/... (such as sunset/sunrise time, moonphase ) which are difficult to find on a PC ... RPi and are not parts of arduino (I tried to find  them..).

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

Avr-libc does not really support ANY of the avr peripherals.
Arduino only suppports some of them, and not all of the avr chips.

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

Well, a beginner cannot start with all and every avr, all and every module (inside or outside), in the past, present

and future.

Maybe understanding one peripheral, with a given avr, is useful (if he has to understand, say, 10 peripherals, time to understand the nine remaining is not 9*time he understood the 1rst).

Arduino have nice examples/demo programs for a limited range of peripherals (and arduino hardware avoids spending a lot of time soldering and veryfying)

avr-libc and its manual are  very good, too

Once he has a part working, knowledge he got can make other parts very easy..

He should have a look at avr-freaks tutorials, too...

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

Oh, Arduino is a fine set of libraries for most applications; not nearly as bad as "the_real_seebs" implies (most code famously "orders of magnitude slower" than bare C is doing orders of magnitude more stuff.  (DigitalWrite(), for instance allows both pin and value to be variables; code written on top of digitalWrite() is much more portable than "direct port IO" code.  Faster special-cased versions are available, if you don't mind orders-of-magnitude difference in performance depending on the arguments...)

 

I just didn't think that Arduino meets the query from the original poster.  (although, it may be the best alternative, especially if you want those "external modules" supported (in some sense) as well.)

 

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

No one has yet mentioned Atmel Software Framework or even the recently renamed Advanced Software Framework http://asf.atmel.com/docs/latest/architecture.html . It has a large set of drivers aimed mostly at XMEGA & UC3 however but there is still a fiar amount of MEGA support.

 

It doesn't seem to get much traction amoungst posters here so I'll add it at the bottom of the list. I don't have any experience of Fleury, Stang or Martin Thomas to properly rate is against the others.

 

  • Arduino
  • Fleury
  • Stang
  • Martin Thomas
  • Atmel Software Framework

 

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

N.Winterbottom wrote:
No one has yet mentioned Atmel Software Framework
No one has yet mentioned "Start": http://start.atmel.com/

 

(curious that is still "atmel.com" - has not migrated to the microchip.com domain ??)

 

Like ASF, Start tends to focus on recent/modern silicon so the only coverage for tiny/mega is really these recent "xmega alikes".

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

newbie-avr wrote:
least best

Eh?

 

So you're actually looking for ones to avoid ... ?

 

C/C++

Note that there is no such thing as "C/C++" - so is it C you want, or C++ ?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Note that there is no such thing as "C/C++"?
Well that's not entirely true. Here's just one (fairly well known!) example:

 Directory of C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino

18/08/2016  10:24    <DIR>          .
18/08/2016  10:24    <DIR>          ..
17/08/2016  17:41             1,222 abi.cpp
17/08/2016  17:41             7,286 Arduino.h
17/08/2016  17:41            11,214 binary.h
17/08/2016  17:41             8,078 CDC.cpp
17/08/2016  17:41             1,529 Client.h
17/08/2016  17:41             7,743 HardwareSerial.cpp
17/08/2016  17:41             5,254 HardwareSerial.h
17/08/2016  17:41             2,605 HardwareSerial0.cpp
17/08/2016  17:41             2,315 HardwareSerial1.cpp
17/08/2016  17:41             1,975 HardwareSerial2.cpp
17/08/2016  17:41             1,975 HardwareSerial3.cpp
17/08/2016  17:41             4,469 HardwareSerial_private.h
17/08/2016  17:41             1,142 hooks.c
17/08/2016  17:41             2,909 IPAddress.cpp
17/08/2016  17:41             2,861 IPAddress.h
17/08/2016  17:41             1,372 main.cpp
17/08/2016  17:41             1,027 new.cpp
17/08/2016  17:41               979 new.h
17/08/2016  17:41             2,725 PluggableUSB.cpp
17/08/2016  17:41             2,063 PluggableUSB.h
17/08/2016  17:41             5,442 Print.cpp
17/08/2016  17:41             2,614 Print.h
17/08/2016  17:41             1,335 Printable.h
17/08/2016  17:41               963 Server.h
17/08/2016  17:41             8,800 Stream.cpp
17/08/2016  17:41             6,126 Stream.h
17/08/2016  17:41            15,022 Tone.cpp
17/08/2016  17:41             4,180 Udp.h
17/08/2016  17:41             6,253 USBAPI.h
17/08/2016  17:41            20,227 USBCore.cpp
17/08/2016  17:41             8,435 USBCore.h
17/08/2016  17:41             1,519 USBDesc.h
17/08/2016  17:41             4,576 WCharacter.h
17/08/2016  17:41             9,409 WInterrupts.c
17/08/2016  17:41            12,024 wiring.c
17/08/2016  17:41             7,700 wiring_analog.c
17/08/2016  17:41             4,978 wiring_digital.c
17/08/2016  17:41             2,255 wiring_private.h
17/08/2016  17:41             3,435 wiring_pulse.c
17/08/2016  17:41             6,022 wiring_pulse.S
17/08/2016  17:41             1,550 wiring_shift.c
17/08/2016  17:41             1,641 WMath.cpp
17/08/2016  17:41            16,928 WString.cpp
17/08/2016  17:41             9,880 WString.h
              44 File(s)        232,057 bytes

which makes an interesting mix of C, C++ and Asm in fact.

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

awneil wrote:
So you're actually looking for ones to avoid ... ?

I doubt it very much.

 

In all newbie-avr's few posts so far; he asks a simple, short and broad question, then makes zero contribution to the rest of the thread. Not even thanking contributors for their replies.

 

My Troll Alarm has just been triggered.

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

I didn't say that you can't mix C and C++ in a single project.

 

cheeky

 

But a library is going to be either a "C library", or a "C++ library" (or, more precisely, is going to present either a C or a C++ interface).

 

 

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
But a library is going to be either a "C library", or a "C++ library"
Arduino isn't - it's a library with some bits in C and some bits in C++. You could use the C bits (basically wiring*.c) in a C only project. You could use things like delayMicroseconds(), analogRead(), analogWrite() etc. Of course you couldn't use something like the Serial class in such a C project.

 

In fact the history of things looks like the original "Wiring" was a C project, then the Arduino folks took that as the basis of a C++ library and wrapped some more C++ around it.

Last Edited: Tue. May 29, 2018 - 10:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"or, more precisely, is going to present either a C or a C++ interface"

 

Well, when reading that, I was terrified : would programmers not know the nuance between inclusive or and exclusive or?

 

In the PC world, such an horrible thing is not likely

sh-4.1$ grep __cplusplus  /usr/include/*h |wc
grep: /usr/include/scsh: Is a directory
    733    2023   35337
sh-4.1$ ls /usr/include/*h |wc
    613     612   14473

Many libraries can be "invoked" from C  (, Fortran with restrictions) or C++ programs according to one's tastes, thanks to the programmers logical skills...

 

BTW : perhaps answer to OP is that libraries that can solve each and every issue can be found in the Vatican or inside Lalesh Temple...