Chapter1 Introduction
Chapter1 Introduction
Embedded Programmings
Chapter 1: Introduction
Lecturer: Dr. Hoang Duc Chinh (Hoàng Đức Chính)
Department of Industrial Automation
School of Electrical Engineering
Email: [email protected]
© DIA 2020.2
Content
1.1. Course Description
1.2. Introduction of programming technique
1.3. Programming Paradigms
1.4. Software development process
1.5. Fundamentals of C/C++ languages
1.6. Getting started
Iterative method
int kq = 1;
while (N > 1)
kq *= N--;
return kq;
Lecture 1: Introduction © DIA 2020.2 21
How to program well?
Learn the way of thinking and programming methodologies
Mathematical thinking, logical thinking, structure thinking, OOP
thinking and generic thinking
Exploring data structures and algorithms
Understand the computer
Interaction amongst CPU, Programs and Memory
Memory management
Mastering the programming language
Understand the strengths and limits of the language
Programming skill
Self-practicing
Understand the above aspects
Keep practicing
Creativity
Lecture 1: Introduction © DIA 2020.2 22
Basic principles
Abstraction
Encapsulation
Modularization
Decentralization
“Keep it simple :
as simple as possible,
but no simpler”
- Albert Einstein
// return output y
Analysis Coding
Testing
Object-oriented
design
Two approaches
Structure design, or
top-down design
Break the
system into
procedures
to solve Starting with
problems general then
detailed design
Logic error
would cause unexpected
Desk check
Developer uses testing data results
to verify the program
Structured walkthrough
Test data Developer describes algorithm
is similar to actual data while the programming team
which should be validate program logic
processed by the program
Compiler
Compiled
code
Linker Library
Executable
program
Deploy &
Execute
Lecture 1: Introduction © DIA 2020.2 59
Developing tools / environment
IDE (Integrated Development Environment)
Support the whole process of programming
E.g.: MS Visual Studio, Borland C++ (Builder), Keil-C
Tools
Editor
Compiler
Linker
Loader
Debugger
Project manager
https://spectrum.ieee.org/computing/software/the-top-
programming-languages-2019
https://spectrum.ieee.org/at-work/tech-careers/top-programming-
Lecture 1: Introduction
language-2020 © DIA 2020.2 66
“C makes it easy to shoot
yourself in the foot;
C++ makes it harder, but
when you do it blows your
whole leg off.”
― Bjarne Stroustrup
Lecture 1: Introduction © DIA 2020.2 67
1.6 Getting started
Windows:
Install Visual Studio Code (VS Code)
https://code.visualstudio.com/download
Install C++ extension for VS Code
Install MinGW-w64 (https://sourceforge.net/projects/mingw-w64/)
in a folder with simple path, i.e.: C\mingw64
Set Mingw64\bin in Windows Environment Variables
Linux:
gcc or g++ may be installed by default, otherwise install it:
sudo apt-get update
sudo apt-get install build-essential gdb
MacOS: Use Clang for compiling
Check if Clang is install: clang --version
Install it: xcode-select --install