0% found this document useful (0 votes)
81 views6 pages

ISE DevelopmentEnvironment v1.3

This document provides instructions for setting up a basic C++ development environment for use in an engineering course focused on developing intelligent autonomous systems. It recommends installing the GNU C/C++ compiler and the Eclipse CDT integrated development environment to provide a simple but complete open source toolchain for C++ development. The document then provides step-by-step instructions for installing these software packages on Linux, macOS, and Windows systems.

Uploaded by

Ricardo Sanz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views6 pages

ISE DevelopmentEnvironment v1.3

This document provides instructions for setting up a basic C++ development environment for use in an engineering course focused on developing intelligent autonomous systems. It recommends installing the GNU C/C++ compiler and the Eclipse CDT integrated development environment to provide a simple but complete open source toolchain for C++ development. The document then provides step-by-step instructions for installing these software packages on Linux, macOS, and Windows systems.

Uploaded by

Ricardo Sanz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

ISE TN01 v1.

3
Setting-up the INGENIA SE Development
Environment
Ricardo Sanz ∗

UPM Autonomous Systems Laboratory

Technical note TN01 v1.3 — INGENIA Systems Engineering Course

This technical note succinctly describes the process to set-up a de- • The software incorporates artificial intelligence technolo-
velopment environment for C++ development to be used in the gies.
INGENIA SE course. It describes what is needed to install a basic • The software is distributed, i.e. is a collection of coupled
toolchain for C++ development and also what is needed for devel- programs running on a set of connected computers.
oping using an integrated development environment. • The software is embedded, i.e. runs on (usually small)
computers that are parts of larger systems.
Keywords: programming | C++ | toolchain | CygWin | IDE | Eclipse • The software is real-time, i.e. it has requirements con-
cerning the time taken to do some specific computations.

I NGENIA Systems Engineering (ISE) focuses on systems en-


gineering of software-intensive autonomous systems. This
requires from the student teams the capability of program-
These last issues —esp. the embedded real-time
character— pose specific requirements for the programming
ming complex applications. These applications are commonly languages to be used. The most natural election — i.e. fol-
built using state-of-the-art compilers and integrated develop- lowing common trends in industry— is to use C/C++ as
ment environments to easy the software development process. development languages for these systems. C/C++ provide
This technical note (TN01) gives instructions on how to mechanisms to easy connect to hardware and to control the
set up a simple, personal development environment to write timely execution of programs (in collaboration with the oper-
C/C++ programs. ating system).
The initial sections provide some general knowledge about C is an historical —from the 70s—, mainstream language
the issues at hand: the tasks to be performed, the tool alterna- that was a major hit in systems and embedded program-
tives, the chosen tools for this simple environment, etc. The ming. C++ is a modern, sophisticated programming lan-
following sections describe step by step the process to set-up guage that provides resources for imperative programming,
the programming environment using i) the GCC toolchain as object-oriented programming and generic programming. It is
backend and ii) the Eclipse CDT IDE as frontend. It is better a language widely used and supported as inheritor of the C
to follow the order described in this technical note to avoid language tradition in systems programming.
dependence and/or configuration problems (esp. of the IDE). This technical note describes what shall be installed in
your computer to have a basic toolchain for C/C++ develop-
ment and also what is needed for developing using an inte-
Contents grated development environment (IDE) —a user friendly way
of using the language toolchain .
Introduction 1 While there are many C/C++ toolchains and many IDEs
available, we will specifically focus on open source software of
The C and C++ Languages 1 common use and wide availability:
• The GNU C/C++ compiler system.
C++ Toolchains 2 • The Eclipse CDT development environment.

Installing a C++ toolchain 3 These two are the most used and most widely available
In Linux systems . . . . . . . . . . . . . . . . . . . . 3 tools, hence the effort dedicated to learn them will not be
In OSX systems . . . . . . . . . . . . . . . . . . . . . 3 wasted because it could be leveraged everywhere.
In Windows systems . . . . . . . . . . . . . . . . . . 3

The Eclipse C/C++ Development Toolkit 3 The C and C++ Languages


C (Kernighan and Ritchie, 1988; ISO/IEC, 2018) and C++
Step by Step Installation of a C++ Environment 4 (Stroustrup, 2014; ISO/IEC, 2014, 2017)1 are the program-
Summary of needed software . . . . . . . . . . . . . 4 ming languages most used in the development of embedded
systems. C and C++ are both used in application program-
Details on Installing CygWin 4 ming and systems programming. C++ provides mechanisms
Setup Cygwin toolchain in Eclipse CDT . . . . . . . 5
About ISE
INGENIA Systems Engineering is a transversal competences course focused on the application
Introduction of systems engineering to the construction of an embedded intelligent system with augmented
In ISE we develop an intelligent system where intelligence autonomy. Autonomy is a technical property of systems that make them capable of sustained
provision of a particular service even in the presence of major uncertainties in the service demand,
comes from the execution of sophisticated software for per- the context of service execution and the disturbances that the system may be suffering from outside
ception, decision-making and control of a physical system. or inside.
This kind of software for controlling systems departs from 1
Standards are revised frequently. Current C++ standard is dated 2017 and the previous one is
common desktop applications in several aspects: dated 2014. Some compilers may not support the most recent versions.

INGENIA Systems Engineering ISE October 1, 2018 TN01 v1.3 1–7


for generic programming. While there are some concerns So said, in what follows we will refer to C++ and
about the use of C++ for real-time systems, the capability not to C (unless specifically noted). Updated information
that it provides for both the small-scale of hardware-related on the evolution of the C++ standard can be found at
issues and the large-scale of complex modular applications https://isocpp.org/std/the-standard.
make it the language of election for this class of systems.
While C and C++ are two different languages, C++ can
be considered a de facto superset of C. Differences between C C++ Toolchains
and the equivalent subset of C++ are minimal (See for exam- To write software in C++ we need a C++ toolchain. A
ple section 44.3 of the Stroustrup book (Stroustrup, 2014)). toolchain is a set of programming tools that are used to cre-
This implies that a programmer using a C++ environment can ate a software product (typically an executable program). The
in fact produce ISO-C compliant code. Standard-compliant tools in the tool set will depend on the type of programming
code is code that strictly follows a standard. This is of enor- languages and the development and execution environments
mous importance to guarantee stability, quality and, espe- for the final programs. C++ is a compiled language, hence
cially, portability. the minimal toolchain is a C++ compiler/linker capable of
generating executable programs.

Source File Executable


Object File
c., .h, Compiler Linker File
.o
.cc,.hh .exe

Library File
Archiver .a

Debugger

Build File
Builder
.make

Figure 1 – A common workflow in the world of C++ programming. The collection of chained tools —the curved boxes— is usually called
toolchain.

most important aspect for us is that GCC is available for most


There are many C++ compilers that are steadily main- embedded systems both as a native or cross compiler.
tained to keep track of recent developments in the C++ lan- Some of the tools that are included in the GNU toolchain
guage. Some of them are the following: GCC, Clang, MSVC, are:
EDG eccp, Intel C++, IBM XLC++, Sun/Oracle C++, Em-
barcadero C++ Builder, Cray, Portland Group (PGI) HP • GNU Compiler Collection (GCC5 ): a suite of compilers for
aCC, and Digital Mars C++.
several programming languages (we are only interested in
The most known and used are GCC2 (the GNU C/C++
C/C++ compilers gcc and g++).
Compiler), Clang3 (the C++ frontend to the LLVM compiler • GNU make: an automation tool for compilation and build.
infrastructure) and MSVC4 (Microsoft Visual C++ Com- • GNU Binutils: a suite of tools including the ld linker, the
piler). MSVC is specifically targeted towards MS Windows
as assembler and other tools related to binary files6 .
applications, while GCC and Clang are cross-platform com- • GNU bison: a parser generator, often used with the flex
pilers. GCC is the historically most relevant compiler, while
lexical analyser.
Clang is a recent incorporation intended to fully replace GCC. • GNU m4: a macro pre-processor.
Both GCC and Clang would be adequate for the ISE purposes. • GNU gdb: a code debugging tool.
We will use GCC in this technical note as is it the most used
toolchain in the embedded systems domain.
The GNU Compiler Collection (GCC) is a compiler system 2
https://gcc.gnu.org/
produced by the GNU Project supporting various program- 3
https://clang.llvm.org/
ming languages. GCC has been ported to produce executable 4
https://docs.microsoft.com/en-us/cpp/
code for a wide variety of computer architectures, being used 5
The original meaning of the acronym ”GCC” was ”GNU C Compiler” because the native compiler
in the development of both free and proprietary software. The in original UNIX systems was simply called ’cc’ — i.e. C Compiler.
6
The term ”binary file” is used to refer to files not readable by humans and intended to be used by
the computer or by programs. Paradigmatic examples are images, object files generated by compilers
and executable files generated by linkers.

2 INGENIA Systems Engineering R.Sanz


• GNU auto-configurable build system (autotools): autoconf, features. These variants of bareback programming toolchains
automake and libtool. are known as Integrated Development Environments (IDE).

Figure 2 – Using the gcc compiler in an Ubuntu system.

From all these tools, we will only explicitly use the C++
compilation driver ( g++ ) the debugger ( gdb ) and the build
tool ( make ). Other tools will be implicitly used (for example
the m4 preprocessor or the linker). Figure 3 – The Eclipse CDT workbench.

Installing a C++ toolchain There are many IDEs out there. The best known ones are
In Linux systems. This is a natural environment for the GCC Microsoft Visual Studio in Windows systems, Apple XCode in
toolchain; just use the software installation commands of your OSX boxes and Eclipse in all classes of environments (Win-
Linux distribution. For example, in Ubuntu just write in a dows, OSX and Linux). This wider availability makes Eclipse
console the command ’sudo apt-get install g++”. the best IDE for systems engineers (that are never tied to
particular technologies and systems).
Eclipse is in fact not an IDE but an empty platform for
In OSX systems. Apple OSX is the natural environment of IDE construction. It can be extended to support many classes
Clang/LLVM; so in these systems it is natural to use Clang of software development projects. In the C and C++ domains,
more than GCC. Compilers are installed as part of the large Eclipse is enlarged into an IDE by means of the installation
XTools install but can also be installed alone as a separate of the C/C++ Development Toolkit (CDT). The CDT is a
package (look for ’Command Line Tools’, available as a sepa- collection of Eclipse-based features/plugins that provides the
rate download from the Apple developers website.) capability to create, edit, navigate, build, and debug projects
that use C and/or C++ as a programming language (See Fig-
ure 3).
In Windows systems. There are several ways of having a GCC However, the CDT just extends the Eclipse user frontend
compiler in a Windows box. The most used alternatives are environment and it does does not include the necessary back-
CygWin and MinGW. MinGW, a contraction of ”Minimal- end compilers. Compilers —and associated tools like linkers,
ist GNU for Windows”, is simpler and provides a minimalist profilers or debuggers— are used to convert C/C++ code into
development environment for native Microsoft Windows ap- binary executable programs and to inspect, assess or debug
plications. However, I recommend CygWin that provides a those programs. The CDT provides the frameworks that al-
complete UNIX-like environment that supports the complete low such backend toolchain elements to be integrated in a
GNU toolchain. consistent fashion hence providing an effective C/C++ IDE.
In all these cases, the program is written with any editor The Eclipse versatility is always there to allow you to mix and
and the compilation is done giving compilation commands in match such or other tools depending on your project require-
a console (see Figure 2). ments.
In many cases the host and the target of a specific de- Sometimes, specific distributions of the Eclipse/CDT —
velopment project coincide ( e.g. programming in a Linux e.g. some commercial distributions— do include the necessary
computer to execute in the same or another similar Linux toolchain and the frontend integrations. If yours does not —
computer). In other cases host and target do not coincide as is the case of plain vanilla Eclipse—, the base CDT does
and it is necessary to install a cross-compilation toolchain. provide support for integration with some common toolchains
—e.g. the GNU tools— for code build and debug. All this
means that if you want to use Eclipse/CDT you must previ-
The Eclipse C/C++ Development Toolkit ously install a C++ toolchain like GCC.
The use of command line tools is extremely effective but cum-
bersome for large scale code development that needs multiple
tools. This is especially important concerning code manage-
ment and visualization. The common strategy is to integrate
multiple tools in a graphical environment that provides easy
access to the many tools and visual rendering of many code

R.Sanz ISE October 1, 2018 TN01 v1.3 3


Figure 5 – The CygWin setup package selection tool.

To experiment with C++ programming only Step 1 is nec-


essary (Install C++ toolchain). This will install just the Cyg-
Win environment that is used in the same way as a Linux ter-
minal ( i.e. using GCC command line tools for compilation).
In this case you must find an editor to write the programs
Figure 4 – The Eclipse online help system contains help for
(because you are not installing the IDE that provides it). In
the available plugins of a specific release. It can be found at
http://help.eclipse.org. The figure shows the help content CygWin you may install UNIX-like editors ( e.g. vim) but
for the Eclipse Oxygen release. The C/C++ Development User you can also use a native Windows application like Notepad
Guide item on the left provides help on CDT use. or Wordpad or else install in Windows a programmer-friendly
editor like Notepad++, Sublime Text or Visual Studio Code
(this last is a good election).
Step by Step Installation of a C++ Environment
Summary of needed software. In summary, for a full devel-
This section describes the process to install a programming opment environment it is necessary to install the following
environment for C++ in Windows. This environment will be software:
based on the GCC toolchain. The real toolchain will be pro-
vided by CygWin and we will add the Eclipse CDT to have a • CygWin with the gcc-g++ package.
graphical frontend to it ( i.e. an IDE). • Java runtime for Eclipse execution.
• Eclipse with the CDT plugin preinstalled.

1. Install the C++ toolchain: Details on Installing CygWin


As was said before, to experiment with C++ programming
(a) Download CygWin Setup tool7 (setup-x86.exe or only a C++ toolchain -and an editor- is needed. We will use
setup-x86 64.exe for 32 and 64 bit Windows). the CygWin GCC toolchain. To install CygWin you must i)
download and execute the installer program, ii) give some in-
(b) Execute CygWin setup tool and install the latest GNU stallation parameters, iii) choose packages to install and iv)
C++ package (gcc-g++). Other tools in the toolchain do the installation.
requiere the installation of other packages ( e.g. to use The most important decisions are i) select the right in-
the make tool we must install the make package. staller (32 or 64 bit), ii) choose a good download site (I al-
ways use ftp://mirror.switch.ch because I’m quite old and it
2. Install Eclipse CDT: has been there since I was a student), and iii) choose the
packages to install. The installer can be executed again when
needed to install, update or remove packages).
(a) Download and install a Java runtime. Note that The installer package selection list has several columns
Eclipse is a Java application. Having a Java runtime (see Figure 5):
environment8 in your Windows system is necessary for
running Eclipse. Current: The currently installed version (this makes sense
when updating CygWin).
(b) Download Eclipse with the CDT plugin pre-installed New: What the installer will do ( e.g. skip, keep, reinstall,
from the http://eclipse.org website9 . Oxygen is the uninstall, or install a concrete version of the package).
codename for the last Eclipse version. This package is Bin?: Install the binary packages ( i.e. the executable pro-
called Eclipse IDE for C/C++ Developers. There grams). This is what we need.
are download links for Windows 32-bit, Windows 64-bit, Src?: Install the source packages ( i.e. the original source
Mac OS X, Linux 32-bit and Linux 64-bit. programs written by the package programmers). This is
needed by people that do special things with the software.
We don’t need it.
(c) Uncompress the downloaded Eclipse package and exe-
cute Eclipse.exe to configure it to use the CygWin GCC
toolchain. As with most Java applications, you can 7
https://cygwin.com/install.html
decompress and place the Eclipse folder with the ex- 8
https://java.com/en/download/
ecutable program wherever you like. 9
http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/oxygen1

4 INGENIA Systems Engineering R.Sanz


Categories: The packages are organised in categories to help In most packages it says ”skip” (that means they will not
manage them. Ours are in the ”Devel” category. be installed). Clicking on the icon of the double circular arrow
Size: The amount of disk storage that the installation will -in the ”New” column- the action will change (install a ver-
use. This is important for small systems- sion, update to another version, uninstall etc. ). Sometimes
Package: The name of the package to be installed. For con- choosing a package or updating one will automatically select
sole use we only need the C++ compiler that is installed other packages ( e.g. selecting gcc-g++ will automatically
with the ”gcc-g++” package. To quickly find this package select gcc-core).
write ”g++” in the CygWin setup program search box. After selecting the packages you can proceed to in-
stall/upgrade.

Figure 6 – Compiling and executing a program in the CygWin environment. The CygWin setup package selection tool is also seen.

• make
After this you will have a CygWin installation that you • gdb
can use runningn the cygwin program —a console where you
can work like in a UNIX system (see Figure 6) . Add %cygwin%\bin to your Windows PATH, so when
you open eclipse the Cygwin programs will be available to
Setup Cygwin toolchain in Eclipse CDT. If you want to use it. The Cygwin toolchain will be shown when you create a
the CygWin toolchain as a backend for the Eclipse CDT IDE, new C/C++ project using the wizard.
it is necessary to do some extra configuration steps to link To use the gdb debugger it may be necessary to estab-
Eclipse with the CygWin toolchain. lish some ”drive mappings” to give access to source code for
First, to easy Eclipse configuration, you must install debug. This is done in the Eclipse Preferences configuration
first CygWin and after this is installed and working, install panel.
Eclipse+CDT. In Eclipse, go to Windows → Preferences → C/C++→
For a quite complete Cygwin toolchain installation that Debug → Common Source Lookup. Add the following ’Path
can support most Eclipse CDT features these are the sug- mappings’:
gested CygWin packages to be installed:
\cygdrive\c → c:\
• binutils \cygdrive\d → d:\
• gcc
• gcc-core plus any other drives if any . . .
• gcc-g++
• gcc-mingw-core
• gcc-mingw-g++

R.Sanz ISE October 1, 2018 TN01 v1.3 5


Glossary object-oriented programming is a form of programming
C is a programming language defined in (Kernighan and where code and that data it manipulates are conjointly
Ritchie, 1988). 1 encapsulated in program modules usually called objects. 1

application programming is the development of programs systems programming is the development of programs
that serve some purpose external to the computer system that are part or deeply linked to operating systems, in op-
— i.e. applications of interest to some final user. 1 position to application programming, where the programs
serve some purpose external to the computer system. 1
backend the part of the tooling that does not interface with
the user (i.e. the programmer) and performs the real work. target is the computer system where a particular software
1 will be executed. See host. 3
toolchain is the collection of elementary tools used to trans-
form source code into target executables. 1, 2, 4
C++ is a programming language evolved from C by inclu-
sion of the concept of class. It is defined in (Stroustrup,
2014). 1, 2 References
cross compiler a compiler executed in a platform to gener-
ISO/IEC (2014). ISO/IEC 14882:2014 – programming lan-
ate code for a different platform ( e.g. compile in Windows
guages - C++. International standard, International Stan-
generating an executable for Linux). 2
dards Organisation.
ISO/IEC (2017). ISO/IEC 14882:2017 – programming lan-
features are a form of packaging pluggable extensions of the guages - C++. International standard, International Stan-
Eclipse platform. 3 dards Organisation.
frontend the part of the tooling that interfaces with the user ISO/IEC (2018). ISO/IEC 9899:2018 - information technol-
(i.e. the programmer). 1 ogy - programming languages - C. International standard,
International Standards Organisation.
generic programming is a form of programming where Kernighan, B. and Ritchie, D. M. (1988). The C Programming
generic program snippets can be adapted to manipulate Language. Addison-Wesley, Reading, MA, second edition.
custom data types. 1, 2 Stroustrup, B. (2014). The C++ Programming Language -
4th Edition. Addison-Wesley, Reading, MA, fourth edition.
host is the computer system where a particular software is
developed. See target. 3, 6

IDE see Integrated Development Environment. 1, 3


imperative programming is a form of programming where
program instructions are orders given to perform a specific
action. 1 The ISE logo highlights the abstract
integrated development environment a set of integrated nature of systems thinking. Abstrac-
tools usually employed in the production of software ( e.g. tion is the key to good programming.
an editor, a debugger, a compiler, etc. ). 1

6 INGENIA Systems Engineering R.Sanz

You might also like