AVR development with Nodate

Microchip provides a binary version of the GCC toolchain for AVR development. At the time of writing, the most recent release of AVR-GCC is 3.6.1, containing GCC version 5.4.0. This implies full support for C++14 and limited support for C++17.

Using this toolchain is pretty easy. One can simply download it from the Microchip website, extract it to a suitable folder, and add the folder containing the GCC executable files to the system path. After this, it can be used to compile AVR applications. Some platforms will have the AVR toolchain available via a package manager as well, which makes the process even easier.

One thing that one may notice after installing this GCC toolchain is that there is no C++ STL available. As a result, one is limited to just the C++ language features supported by GCC. As the Microchip AVR FAQ notes:

  • Obviously, none of the C++ related standard functions, classes, and template classes are available.
  • The operators new and delete are not implemented; attempting to use them will cause the linker to complain about undefined external references. (This could perhaps be fixed.)
  • Some of the supplied include files are not C++ safe, that is, they need to be wrapped into extern"C" { . . . }. (This could certainly be fixed, too.)
  • Exceptions are not supported. Since exceptions are enabled by default in the C++ frontend, they explicitly need to be turned off using -fno-exceptions in the compiler options. Failing this, the linker will complain about an undefined external reference to __gxx_personality_sj0.

With the lack of a Libstdc++ implementation that would contain the STL features, we can only add such functionality by using a third-party implementation. These include versions that provide essentially the full STL, as well as lightweight re-implementations that do not follow the standard STL API. An example of the latter is the Arduino AVR core, which provides classes such as String and Vector, which are similar to their STL equivalents albeit with some limitations and differences.

An upcoming alternative to the Microchip AVR GCC toolchain is LLVM, a compiler framework to which experimental support for AVR as been recently added, and which at some point in the future should allow producing binaries for AVR MCUs, all the while providing full STL functionality via its Clang frontend (C/C++ support).

Consider this an abstract snapshot of LLVM developmentā€”all the while illustrating the general concept of LLVM and its emphasis on Intermediate Representation.

Unfortunately the PIC range of MCUs, despite also being owned by Microchip and resembling AVR in many ways, does at this point not have a C++ compiler available for it from Microchip until one moves up to the PIC32 (MIPS-based) range of MCUs.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.79.176