Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
17 views13 pages

Chapter 3

This document summarizes the process of developing embedded programs. It discusses that embedded programming is similar to other types of programming but requires understanding the target hardware. It describes the three main steps to convert source code into an executable binary: compilation, linking, and locating. Compilation translates human-readable code into machine code. Linking combines object files and resolves references. Locating assigns physical addresses to produce the final executable binary that can run on the embedded system.

Uploaded by

nahimannow9
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)
17 views13 pages

Chapter 3

This document summarizes the process of developing embedded programs. It discusses that embedded programming is similar to other types of programming but requires understanding the target hardware. It describes the three main steps to convert source code into an executable binary: compilation, linking, and locating. Compilation translates human-readable code into machine code. Linking combines object files and resolves references. Locating assigns physical addresses to produce the final executable binary that can run on the embedded system.

Uploaded by

nahimannow9
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/ 13

CHAPTER THREE

EMBEDDED PROGRAMS
Introduction
Every programming book ever written begins with the same example—a
program that prints "Hello, World!" on the user's screen
Based on the "Hello, World!" benchmark, embedded systems are among
the most challenging computer platforms for programmers to work with.
A popular substitute for the "Hello, World!" program is one that blinks an
LED at a certain rate of frequency.
because almost all embedded systems have LEDs, the underlying concept
is extremely portable.
Example:
Program development cycle
Program Translation Process
• Embedded systems programming is not substantially
different from the programming you've done before.
• The difference is you need to have an understanding of
the target hardware platform
• Furthermore each target hardware platform is unique
• Unfortunately, this uniqueness among hardware
platforms leads to a lot of additional software
complexity.
Build Process
• converting the source code representation of your
embedded software into an executable binary image
involves three distinct steps:
• Each of the source files must be compiled or assembled
into an object file.
• 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.
• Physical memory addresses must be assigned to the
relative offsets within the relocatable program in a
process called relocation.
…continued
Compiler/assembler
• Compiling/assembling :the process of translate
programs written in some human-readable
language into an equivalent set of opcodes for a
particular processor
• performs a much simpler one-to-one
• translation from one line of human-readable
mnemonics to the equivalent opcode.
• A compiler that runs on one computer platform
and produces code for another—is called a
cross-compiler
• Regardless of the input language (C, C++, assembly, or
any other), the output of the cross-compiler will be an
object file.
• The structure of the file is often defined by a standard
format such as the Common Object File Format
(COFF) or Executable and Linkable Format (ELF).
• Although many compilers support standard object file
formats such as COFF and ELF, some others produce
object files only in proprietary formats.
• 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, because
not all of the variables and functions are always
defined in the same file.
• it is the linker to resolve such unresolved
references.
Linking
• the object files resulting from the compilation must be
combined
• The object files created from compiling themselves are
individually incomplete,
• The job of the linker is to combine these object files, and
in the process, to resolve all of the unresolved symbols.
• 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 merge the text, data, and bss sections of the input
files.
• When the linker is finished executing, all of the
machine language code from all of the input object
files will be in the text section of the new file, and all
of the initialized and uninitialized variables will reside
in the new data and bss sections, respectively
• The addresses of the symbols in the linking process
are relative.
• Then how to locate the absolute address?
Locating
• The tool that performs the conversion from
relocatable program to executable binary image
is called a locator.
• The programmer gives the target memory
information to the tool.
• The locator uses this information to assign
physical memory addresses to each of the code
and data sections within the relocatable
program.
• It then produces an output file that contains a
binary memory image that can be loaded into
the target memory of embedded system.

You might also like