Close
0%
0%

Embedding C++

C++ is an efficient language eminently suitable for use in embedded systems but some look for proof of the efficiency. This is the proof.

Similar projects worth following
[Bjorn Stroustrup] developed C++ from C specifically because he wanted the base to be an efficient language. C is often referred to as 'high level assembly'. [Stroustrup's] goal was to add additional capabilities to C without losing that efficiency. For the most part he succeeded. But even today critics point to various features of C++ and say "That's expensive."

This project is going to demonstrate with code that C++ is suitable for embedded projects. A series of articles on Hackaday.com will discuss the capabilities of C++ that are suitable for embedded systems with code snippets demonstrating the usage. In this project, full code will be presented and discussed.

I invite others to share their experience with C++ on embedded systems. If you've had good results share them. If you've had bad, bring them here and we'll look to see what happened.

Table of Contents for the articles on Hackaday.com

  1. C++ TURNS 30 – LOOKING FORWARD TO THE FUTURE
  2. CODE CRAFT: WHEN #DEFINE IS CONSIDERED HARMFUL - Project Log: Define Considered...
  3. CODE CRAFT: USING ECLIPSE FOR ARDUINO DEVELOPMENT - Project Log: Using Eclipse
  4. CODE CRAFT – EMBEDDING C++: CLASSES- Project Log: Classes - No Code Bloat
  5. CODE CRAFT – EMBEDDING C++: TIMING VIRTUAL FUNCTIONS - Project Log: C++ Virtual Function Calls Are Fast
  6. CODE CRAFT-EMBEDDING C++: HIDDEN ACTIVITIES? - Project Log: What is C++ Hiding?

  • 1 × Arduino Development Environment The development environment for Arduino from http://arduino.cc
  • 1 × Eclipse Arduino Plug-In A plugin to allow Arduino development using the Eclipse IDE. Easiest way to obtain this is from http://www.baeyens.it/eclipse/. If you don't have Eclipse installed there is a download link to install it with the plugin. Otherwise install the plugin to your existing Eclipse installation.
  • 1 × Arduino Uno Code will be demonstrated and timed using a Uno. Sources are arduino.cc, Sparkfun, Adafruit, and many others.
  • 1 × Arduino Due Code will be demonstrated and timed using a Due. It will also be used to demonstrate use of the C++ standard libraries that are not supported by the AVR based Arduinos. Sources are Sparkfun, Adafruit, and many others.
  • 1 × Teensy 3.x Code will be demonstrated and timed using a Teensy 3.x. Sources are arduino.cc, Sparkfun, Adafruit, and many others.

  • What is C++ Hiding?

    Rud Merriam11/20/2015 at 17:22 0 comments

    Developers who are new to or uncertain about C++ become concerned about the many details involved in using classes. Some of those details appear to be hidden costs. Actually C++ brings to light aspects of code that need to be considered. They've always existed but when you create a user defined class you're now responsible for everything. That's what the most recent article CODE CRAFT-EMBEDDING C++: HIDDEN ACTIVITIES? addresses.

  • C++ Virtual Function Are Fast

    Rud Merriam11/13/2015 at 17:46 0 comments

    Virtual functions are not a problem for embedded systems. Their raw performance nearly matches normal C calls and in an overall system performance can actually be a faster. CODE CRAFT – EMBEDDING C++: TIMING VIRTUAL FUNCTIONS measures C function calls, C pointer to function calls, and C++ virtual calls and finds them taking the same amount of time, for pratical purposes.

  • Using Classes - No Code Bloat

    Rud Merriam11/06/2015 at 18:24 0 comments

    This article CODE CRAFT – EMBEDDING C++: CLASSES provides a short overview of C++ classes. It compares the code size for equivalent C and C++ versions of Arduino Uno and Due code. The finding is that classes do not increase the size of the code, which is what the article was intended to show.

  • Using Eclipse

    Rud Merriam10/31/2015 at 03:15 3 comments

    The Arduino IDE has limited capabilities. It is basically a text editor with some additional capabilities to add the tool chains for various Arduino boards and call them to build the executable.

    An alternative is Eclipse since it has a plugin that uses the Arduino directories to control the Eclipse project. But Eclipse adds many capabilities for working with C++ (and C!) that make it a better choice than the Arduino IDE. If you have features of Eclipse that you like that weren't mentioned that's what comments are for.

    There are other options to chose from and the article's comments list some of them. I'll try to remember to make a list of them somewhere in this project. Feel free to add comments here about other IDEs. No flame wars, please. Just factual descriptions of what works, how well, etc.

    I'm going to be using Eclipse since I am used to working with it.

  • #Define Considered...

    Rud Merriam10/31/2015 at 03:10 0 comments

    This article is not directly related to this Embedding C++ project. It was written before the project began. But it is applicable because when switching to C++ the need to use macros (#define) is reduced considerably. As the article mentions, this was a specific goal of Bjarne Stroustrup as he developed the language.

View all 5 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates