SlideShare a Scribd company logo
1 of 37
Embedded Systems
By Abebe B.
Embedded programming
Definition of Embedded Systems
Programming
• Embedded systems programming involves
designing and developing software for
embedded systems.
• This software is typically written in low-level
languages such as C and assembly
language and is optimized for the specific
hardware and application requirements of
the system.
Embedded Systems Programming
• Embedded systems programming refers to the
development of software for embedded
systems, which are computer systems that are
integrated into other devices or products.
• These systems are designed to perform specific
functions, and they often have limited
resources, including memory, processing
power, and energy.
• Embedded systems programming is essential
for developing systems that are reliable,
efficient, and cost-effective.
Embedded Languages
 Some of the most commonly used programming languages
for embedded systems programming include:
 C:
• C Programming is a widely used programming language for
embedded systems programming.
• It provides direct access to system resources and is well-suited for
systems with limited resources.
 Assembly language:
• Assembly language is a low-level programming language that
provides direct access to system resources.
• It is often used for systems with very limited resources or for
performance-critical applications.
 C++:
• C++ is a high-level programming language that is often used for
embedded systems programming.
• It provides object-oriented programming features and can be used
to develop complex systems.
Embedded Languages
• More than any other, C has become the
language of embedded programmers.
• This has not always been the case, and it will
not continue to be so forever.
• However, at this time, C is the closest thing
there is to a standard in the embedded world.
– Explain why C ?
Embedded Languages
• It is surprising to find that one language has
proven itself appropriate for both 8-bit and
64-bit processors; in systems with bytes,
kilobytes, and megabytes of memory;
• Of course, C is not without advantages.
Embedded Languages
• C is
– small and fairly simple to learn,
– compilers are available for almost every processor in use today,
and
– there is a very large body of experienced C programmers.
• In addition, it has the benefit of processor-
independence, which allows programmers to
concentrate on algorithms and applications, rather than
on the details of a particular processor architecture.
• However, many of these advantages apply equally to
other high-level languages.
– So why has C succeeded where so many other languages
have largely failed?
Embedded Languages
• Perhaps the greatest strength of C-and the thing that
sets it apart from languages like Pascal and FORTRAN-
is that it is a very "low-level" high-level language.
• C gives embedded programmers an extraordinary
degree of direct hardware control without sacrificing
the benefits of high-level languages.
• The "low-level“ nature of C was a clear intention of the
language's creators.
Embedded Systems Programming
Tools
• Embedded systems programming requires specialized tools to
develop, test, and debug software for these systems.
• These tools include:
– Integrated development environments (IDEs):
• IDEs provide a comprehensive development environment for
embedded systems programming.
• They typically include a code editor, compiler, debugger, and other
tools for developing and testing software.
– Cross-compilers:
• Cross-compilers are used to compile code for a different platform
than the one on which the compiler is running.
– Emulators and simulators:
• Emulators and simulators are used to test software on a virtual
environment that emulates the hardware and software of the target
system.
• They are often used for testing software before it is deployed to the
target system.
Embedded Systems Programming Best
Practices
• Embedded systems programming requires careful attention to
detail and a focus on writing efficient and reliable code.
• To develop software for embedded systems effectively,
developers should follow best practices, including:
– Writing Efficient Code
• Writing efficient code is critical for embedded systems, as these systems
often have limited resources.
• Developers should focus on writing code that is optimized for the specific
hardware and application requirements of the system and should avoid
using unnecessary resources.
Arduino UNO Board
• The Arduino UNO is a standard board of Arduino.
• Arduino UNO is based on an ATmega328P microcontroller. It is easy to use
compared to other boards, such as the Arduino Mega board, etc.
• The board consists of digital and analog Input/Output pins (I/O), shields,
and other circuits.
• The Arduino UNO includes 6 analog pin inputs, 14 digital pins, a USB
connector, a power jack, and an ICSP (In-Circuit Serial Programming)
header.
• The IDE is common to all available boards of Arduino.
Arduino UNO Board
• The Arduino board is shown below:
Arduino UNO Board
• The components of Arduino UNO board are shown below:
Arduino UNO Pinout
• The Arduino UNO Board, with the specification of pins, is shown below:
Your First Embedded Program
• Embedded programmers must be self-reliant. They
must always begin each new project with the
assumption that nothing works-that all they can rely
on is the basic syntax of their programming language.
• Even the standard library routines might not be
available to them. These are the auxiliary functions-
like printf and scanf -that most other programmers
take for granted.
Your First Embedded Program
“Hello, World”
• Every embedded system has at least one LED that
could be controlled by software.
• So my substitute for the "Hello, World!" program has
been one that blinks an LED at a rate of 1 Hz (one
complete on-off cycle per second).
• Typically, the code required to turn an LED on and off
is limited to a few lines of C or assembly, so there is
very little room for programming errors to occur.
Coding Screen
setup()
• The setup() function is called when a sketch
starts. Use it to initialize variables, pin modes,
start using libraries, etc.
• The setup() function will only run once, after
each powerup or reset of the Arduino board.
Example Code
void setup()
{
// initialize digital pin LED_BUILTIN OR PIN13 as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {.......}
loop()
• After creating a setup() function, which
initializes and sets the initial values, the loop()
function does precisely what its name
suggests, and loops consecutively, allowing
your program to change and respond.
• Use it to actively control the Arduino board.
Example Code
void setup() {………..}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000); }
Your First Embedded Program
“turn an LED on and off”
// the setup function runs once when you press reset or power the board
void setup()
{
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop()
{
digitalWrite(LED_BUILTIN, HIGH); // turn the LED ON (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn LED OFF (LOW is the voltage level)
delay(1000); // wait for a second
}
The Role of the Infinite Loop
• One of the most fundamental differences between
programs developed for embedded systems and those
written for other computer platforms is that the
embedded programs almost always end with an
infinite loop.
• Typically, this loop surrounds a significant part of the
program’s functionality-as it does in the Blinking LED
program.
• The infinite loop is necessary because the embedded
software's job is never done. It is intended to be run
until either the world comes to an end or the board is
reset, whichever happens first.
Compiling, Linking, and Locating
The Build Process
The Build Process
• The process of converting the source code
representation of your embedded software into an
executable binary image involves three distinct steps.
– First, each of the source files must be compiled or
assembled into an object file.
– Second, all of the object files that result from the first step
must be linked together to produce a single object file,
called the relocatable program.
– Finally, physical memory addresses must be assigned to the
relative offsets within the relocatable program in a process
called relocation.
– The result of this third step is a file that contains an
executable binary image that is ready to be run on the
embedded system.
The embedded software development
process
The embedded software development
process
• Object file:-
– It is a specially formatted binary file that contains the set
of instructions and data resulting from the language
translation process. Although parts of this file contain
executable code, the object file is not intended to be
executed directly.
– There is also usually a symbol table somewhere in the
object file that contains the names and locations of all the
variables and functions referenced within the source file.
– Parts of this table may be incomplete, however, because
not all of the variables and functions are always defined in
the same file.
– These are the symbols that refer to variables and functions
defined in other source files. And it is up to the linker to
resolve such unresolved references.
The embedded software development
process
The embedded software development
process
• Each of the steps of the embedded software build
process is a transformation performed by software
running on a general-purpose computer.
• The compiler, assembler, linker, and locator are all
pieces of software that run on a host computer, rather
than on the embedded system itself.
• Yet, despite the fact that they run on some other
computer platform, these tools combine their efforts
to produce an executable binary image that will
execute properly only on the target embedded
system.
The split between host and target
Compiling
• The job of a compiler is mainly to translate
programs written in some human-readable
language into an equivalent set of opcodes for
a particular processor.
• Of course, each processor has its own unique
machine language, so you need to choose a
compiler that is capable of producing
programs for your specific target processor.
Compiling
• In the embedded systems case, this compiler
almost always runs on the host computer. It simply
doesn't make sense to execute the compiler on
the embedded system itself.
• A compiler such as this-that runs on one computer
platform and produces code for another-is called a
cross-compiler.
• The use of a cross-compiler is one of the defining
features of embedded software development.
Linking
• All of the object files resulting from step one
must be combined in a special way before the
program can be executed.
• The object files themselves are individually
incomplete, most notably in that some of the
internal variable and function references have not
yet been resolved.
• The job of the linker is to combine these object
files and, in the process, to resolve all of the
unresolved symbols.
Linking
• The output of the linker is a new object file
that contains all of the code and data from the
input object files and is in the same object file
format.
• It does this by merging the text, data, and bss
sections of the input files.
Locating
• The tool that performs the conversion from relocatable
program to executable binary image is called a locator.
• It takes responsibility for the easiest step of the three.
In fact, you will have to do most of the work in this step
yourself, by providing information about the memory
on the target board as input to the locator.
• The locator will use this information to assign physical
memory addresses to each of the code and data
sections within the relocatable program.
• It will then produce an output file that contains a
binary memory image that can be loaded into the
target ROM.
Getting to Know the Hardware
• Before writing software for an embedded
system, you must first be familiar with the
hardware on which it will run.
• At first, you just need to understand the general
operation of the system.
• Whenever you receive a new board, you should
take some time to read whatever documents
have been provided with it.
• If the board is an off-the-shelf product, it might
arrive with a "User's Guide" or "Programmer's
Manual" that has been written with the
software developer in mind.
Arduino Uno
https://www.electronicshub.org/arduino-uno-pinout/
Importance of Embedded
Systems Programming
• Embedded systems are used in a wide range of
products, including automobiles, medical
devices, consumer electronics, and industrial
equipment.
• These systems must be reliable, efficient, and
cost-effective, and embedded systems
programming plays a critical role in achieving
these goals.
• By optimizing software for the specific hardware
and application requirements of the system,
developers can improve system performance,
reduce energy consumption, and minimize costs.
https://www.arduino.cc/reference/en/

More Related Content

Similar to Embedded programming Embedded programming (1).pptx

Computer Programming In C.pptx
Computer Programming In C.pptxComputer Programming In C.pptx
Computer Programming In C.pptxchouguleamruta24
 
Python-unit -I.pptx
Python-unit -I.pptxPython-unit -I.pptx
Python-unit -I.pptxcrAmth
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptxAshenafiGirma5
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introductionmengistu23
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxZiyadMohammed17
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptxPmarkNorcio
 
Bba i-introduction to computer-u-2- application and system software
Bba  i-introduction to computer-u-2- application and system softwareBba  i-introduction to computer-u-2- application and system software
Bba i-introduction to computer-u-2- application and system softwareRai University
 
CHAPTER-1.ppt
CHAPTER-1.pptCHAPTER-1.ppt
CHAPTER-1.pptTekle12
 
Mba i-ifm-u-2-computer software
Mba i-ifm-u-2-computer softwareMba i-ifm-u-2-computer software
Mba i-ifm-u-2-computer softwareRai University
 
Bca i-fundamental of computer-u-2- application and system software
Bca  i-fundamental of  computer-u-2- application and system softwareBca  i-fundamental of  computer-u-2- application and system software
Bca i-fundamental of computer-u-2- application and system softwareRai University
 
Bsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system softwareBsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system softwareRai University
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingAkhil Kaushik
 

Similar to Embedded programming Embedded programming (1).pptx (20)

Computer Programming In C.pptx
Computer Programming In C.pptxComputer Programming In C.pptx
Computer Programming In C.pptx
 
Python-unit -I.pptx
Python-unit -I.pptxPython-unit -I.pptx
Python-unit -I.pptx
 
Compilers.pptx
Compilers.pptxCompilers.pptx
Compilers.pptx
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptx
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introduction
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptx
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
Unit 2
Unit 2Unit 2
Unit 2
 
Bba i-introduction to computer-u-2- application and system software
Bba  i-introduction to computer-u-2- application and system softwareBba  i-introduction to computer-u-2- application and system software
Bba i-introduction to computer-u-2- application and system software
 
CHAPTER-1.ppt
CHAPTER-1.pptCHAPTER-1.ppt
CHAPTER-1.ppt
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
 
Mba i-ifm-u-2-computer software
Mba i-ifm-u-2-computer softwareMba i-ifm-u-2-computer software
Mba i-ifm-u-2-computer software
 
Chapter 4 computer language
Chapter 4 computer languageChapter 4 computer language
Chapter 4 computer language
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Bca i-fundamental of computer-u-2- application and system software
Bca  i-fundamental of  computer-u-2- application and system softwareBca  i-fundamental of  computer-u-2- application and system software
Bca i-fundamental of computer-u-2- application and system software
 
a1.pptx.pdf
a1.pptx.pdfa1.pptx.pdf
a1.pptx.pdf
 
01CHAP_1.PPT
01CHAP_1.PPT01CHAP_1.PPT
01CHAP_1.PPT
 
Bsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system softwareBsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system software
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 

Recently uploaded

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 

Recently uploaded (20)

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 

Embedded programming Embedded programming (1).pptx

  • 1. Embedded Systems By Abebe B. Embedded programming
  • 2. Definition of Embedded Systems Programming • Embedded systems programming involves designing and developing software for embedded systems. • This software is typically written in low-level languages such as C and assembly language and is optimized for the specific hardware and application requirements of the system.
  • 3. Embedded Systems Programming • Embedded systems programming refers to the development of software for embedded systems, which are computer systems that are integrated into other devices or products. • These systems are designed to perform specific functions, and they often have limited resources, including memory, processing power, and energy. • Embedded systems programming is essential for developing systems that are reliable, efficient, and cost-effective.
  • 4. Embedded Languages  Some of the most commonly used programming languages for embedded systems programming include:  C: • C Programming is a widely used programming language for embedded systems programming. • It provides direct access to system resources and is well-suited for systems with limited resources.  Assembly language: • Assembly language is a low-level programming language that provides direct access to system resources. • It is often used for systems with very limited resources or for performance-critical applications.  C++: • C++ is a high-level programming language that is often used for embedded systems programming. • It provides object-oriented programming features and can be used to develop complex systems.
  • 5. Embedded Languages • More than any other, C has become the language of embedded programmers. • This has not always been the case, and it will not continue to be so forever. • However, at this time, C is the closest thing there is to a standard in the embedded world. – Explain why C ?
  • 6. Embedded Languages • It is surprising to find that one language has proven itself appropriate for both 8-bit and 64-bit processors; in systems with bytes, kilobytes, and megabytes of memory; • Of course, C is not without advantages.
  • 7. Embedded Languages • C is – small and fairly simple to learn, – compilers are available for almost every processor in use today, and – there is a very large body of experienced C programmers. • In addition, it has the benefit of processor- independence, which allows programmers to concentrate on algorithms and applications, rather than on the details of a particular processor architecture. • However, many of these advantages apply equally to other high-level languages. – So why has C succeeded where so many other languages have largely failed?
  • 8. Embedded Languages • Perhaps the greatest strength of C-and the thing that sets it apart from languages like Pascal and FORTRAN- is that it is a very "low-level" high-level language. • C gives embedded programmers an extraordinary degree of direct hardware control without sacrificing the benefits of high-level languages. • The "low-level“ nature of C was a clear intention of the language's creators.
  • 9. Embedded Systems Programming Tools • Embedded systems programming requires specialized tools to develop, test, and debug software for these systems. • These tools include: – Integrated development environments (IDEs): • IDEs provide a comprehensive development environment for embedded systems programming. • They typically include a code editor, compiler, debugger, and other tools for developing and testing software. – Cross-compilers: • Cross-compilers are used to compile code for a different platform than the one on which the compiler is running. – Emulators and simulators: • Emulators and simulators are used to test software on a virtual environment that emulates the hardware and software of the target system. • They are often used for testing software before it is deployed to the target system.
  • 10. Embedded Systems Programming Best Practices • Embedded systems programming requires careful attention to detail and a focus on writing efficient and reliable code. • To develop software for embedded systems effectively, developers should follow best practices, including: – Writing Efficient Code • Writing efficient code is critical for embedded systems, as these systems often have limited resources. • Developers should focus on writing code that is optimized for the specific hardware and application requirements of the system and should avoid using unnecessary resources.
  • 11. Arduino UNO Board • The Arduino UNO is a standard board of Arduino. • Arduino UNO is based on an ATmega328P microcontroller. It is easy to use compared to other boards, such as the Arduino Mega board, etc. • The board consists of digital and analog Input/Output pins (I/O), shields, and other circuits. • The Arduino UNO includes 6 analog pin inputs, 14 digital pins, a USB connector, a power jack, and an ICSP (In-Circuit Serial Programming) header. • The IDE is common to all available boards of Arduino.
  • 12. Arduino UNO Board • The Arduino board is shown below:
  • 13. Arduino UNO Board • The components of Arduino UNO board are shown below:
  • 14. Arduino UNO Pinout • The Arduino UNO Board, with the specification of pins, is shown below:
  • 15. Your First Embedded Program • Embedded programmers must be self-reliant. They must always begin each new project with the assumption that nothing works-that all they can rely on is the basic syntax of their programming language. • Even the standard library routines might not be available to them. These are the auxiliary functions- like printf and scanf -that most other programmers take for granted.
  • 16. Your First Embedded Program “Hello, World” • Every embedded system has at least one LED that could be controlled by software. • So my substitute for the "Hello, World!" program has been one that blinks an LED at a rate of 1 Hz (one complete on-off cycle per second). • Typically, the code required to turn an LED on and off is limited to a few lines of C or assembly, so there is very little room for programming errors to occur.
  • 18. setup() • The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. • The setup() function will only run once, after each powerup or reset of the Arduino board. Example Code void setup() { // initialize digital pin LED_BUILTIN OR PIN13 as an output. pinMode(LED_BUILTIN, OUTPUT); } void loop() {.......}
  • 19. loop() • After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. • Use it to actively control the Arduino board. Example Code void setup() {………..} void loop() { digitalWrite(LED_BUILTIN, HIGH); delay(1000); digitalWrite(LED_BUILTIN, LOW); delay(1000); }
  • 20. Your First Embedded Program “turn an LED on and off” // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED ON (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn LED OFF (LOW is the voltage level) delay(1000); // wait for a second }
  • 21. The Role of the Infinite Loop • One of the most fundamental differences between programs developed for embedded systems and those written for other computer platforms is that the embedded programs almost always end with an infinite loop. • Typically, this loop surrounds a significant part of the program’s functionality-as it does in the Blinking LED program. • The infinite loop is necessary because the embedded software's job is never done. It is intended to be run until either the world comes to an end or the board is reset, whichever happens first.
  • 22. Compiling, Linking, and Locating The Build Process
  • 23. The Build Process • The process of converting the source code representation of your embedded software into an executable binary image involves three distinct steps. – First, each of the source files must be compiled or assembled into an object file. – Second, all of the object files that result from the first step must be linked together to produce a single object file, called the relocatable program. – Finally, physical memory addresses must be assigned to the relative offsets within the relocatable program in a process called relocation. – The result of this third step is a file that contains an executable binary image that is ready to be run on the embedded system.
  • 24. The embedded software development process
  • 25. The embedded software development process • Object file:- – It is a specially formatted binary file that contains the set of instructions and data resulting from the language translation process. Although parts of this file contain executable code, the object file is not intended to be executed directly. – There is also usually a symbol table somewhere in the object file that contains the names and locations of all the variables and functions referenced within the source file. – Parts of this table may be incomplete, however, because not all of the variables and functions are always defined in the same file. – These are the symbols that refer to variables and functions defined in other source files. And it is up to the linker to resolve such unresolved references.
  • 26. The embedded software development process
  • 27. The embedded software development process • Each of the steps of the embedded software build process is a transformation performed by software running on a general-purpose computer. • The compiler, assembler, linker, and locator are all pieces of software that run on a host computer, rather than on the embedded system itself. • Yet, despite the fact that they run on some other computer platform, these tools combine their efforts to produce an executable binary image that will execute properly only on the target embedded system.
  • 28. The split between host and target
  • 29. Compiling • The job of a compiler is mainly to translate programs written in some human-readable language into an equivalent set of opcodes for a particular processor. • Of course, each processor has its own unique machine language, so you need to choose a compiler that is capable of producing programs for your specific target processor.
  • 30. Compiling • In the embedded systems case, this compiler almost always runs on the host computer. It simply doesn't make sense to execute the compiler on the embedded system itself. • A compiler such as this-that runs on one computer platform and produces code for another-is called a cross-compiler. • The use of a cross-compiler is one of the defining features of embedded software development.
  • 31. Linking • All of the object files resulting from step one must be combined in a special way before the program can be executed. • The object files themselves are individually incomplete, most notably in that some of the internal variable and function references have not yet been resolved. • The job of the linker is to combine these object files and, in the process, to resolve all of the unresolved symbols.
  • 32. Linking • The output of the linker is a new object file that contains all of the code and data from the input object files and is in the same object file format. • It does this by merging the text, data, and bss sections of the input files.
  • 33. Locating • The tool that performs the conversion from relocatable program to executable binary image is called a locator. • It takes responsibility for the easiest step of the three. In fact, you will have to do most of the work in this step yourself, by providing information about the memory on the target board as input to the locator. • The locator will use this information to assign physical memory addresses to each of the code and data sections within the relocatable program. • It will then produce an output file that contains a binary memory image that can be loaded into the target ROM.
  • 34. Getting to Know the Hardware • Before writing software for an embedded system, you must first be familiar with the hardware on which it will run. • At first, you just need to understand the general operation of the system. • Whenever you receive a new board, you should take some time to read whatever documents have been provided with it. • If the board is an off-the-shelf product, it might arrive with a "User's Guide" or "Programmer's Manual" that has been written with the software developer in mind.
  • 36. Importance of Embedded Systems Programming • Embedded systems are used in a wide range of products, including automobiles, medical devices, consumer electronics, and industrial equipment. • These systems must be reliable, efficient, and cost-effective, and embedded systems programming plays a critical role in achieving these goals. • By optimizing software for the specific hardware and application requirements of the system, developers can improve system performance, reduce energy consumption, and minimize costs.