[go: up one dir, main page]

0% found this document useful (0 votes)
3 views69 pages

Embedded Systems Unit 3

The document discusses Embedded Firmware Design, focusing on the responsibilities and design approaches of embedded firmware, including the Super loop and Embedded Operating System based approaches. It highlights the importance of understanding hardware and programming languages for firmware development, as well as the use of assembly and high-level languages. Additionally, it covers interrupts, their types, and how they interact with the processor during firmware operation.

Uploaded by

Venkata Ramana
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)
3 views69 pages

Embedded Systems Unit 3

The document discusses Embedded Firmware Design, focusing on the responsibilities and design approaches of embedded firmware, including the Super loop and Embedded Operating System based approaches. It highlights the importance of understanding hardware and programming languages for firmware development, as well as the use of assembly and high-level languages. Additionally, it covers interrupts, their types, and how they interact with the processor during firmware operation.

Uploaded by

Venkata Ramana
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/ 69

ADITYA COLLEGE OF ENGINEERING

Approved by AICTE, Permanently Affiliated to JNTUK & Accredited by NAAC


Recognized by UGC under Sections 2(f) and 12(B) of UGC Act, 1956
Aditya Nagar, ADB Road, Surampalem - 533 437.

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

Embedded Systems
Unit-3
Embedded Firmware Design

Presented by:
Mr. M Madhu Manikya Kumar
Assistant Professor
Topics to be Discussed
• Embedded Firmware
• Embedded Firmware design approaches
• Embedded Firmware development languages
• ISR concept
• Interrupt sources
• Interrupt servicing mechanism
• Multiple interrupts
• DMA
• Device driver programming
• Concepts of C versus Embedded C and Compiler versus Cross-compiler
Embedded Firmware
• The embedded firmware is responsible for controlling the various peripherals of
the embedded hardware and generating response in accordance with the functional
requirements of the product.
• The embedded firmware is the master brain of the embedded system.
• The embedded firmware imparts intelligence to an Embedded system.
• It is a onetime process and it can happen at any stage.
• The product starts functioning properly once the intelligence imparted to the
product by embedding the firmware in the hardware.
• The product will continue serving the assigned task till hardware breakdown
occurs or a corruption in embedded firmware.
• In case of hardware breakdown , the damaged component may need to be replaced
and for firmware corruptions the firmware should be re-loaded, to bring back the
embedded product to the normal functioning.
• The embedded firmware is usually stored in a permanent memory (ROM) and it is
non alterable by end users.
• Designing Embedded firmware requires understanding of the particular embedded
product hardware, like various component interfacing, memory map details, I/O
port details, configuration and register details of various hardware chips used and
some programming language (either low level Assembly Language or High level
language like C/C++ or a combination of the two)
• The embedded firmware development process starts with the conversion of the
firmware requirements into a program model using various modeling tools.
• The firmware design approaches for embedded product is purely dependent on the
complexity of the functions to be performed and speed of operation required.
Embedded Firmware design approaches

• There exist two basic approaches for the design and implementation of embedded
firmware, namely;

 The Super loop based approach


 The Embedded Operating System based approach

 The decision on which approach needs to be adopted for firmware development is


purely dependent on the complexity and system requirements
The Super loop based approach

• The Super loop based firmware development approach is Suitable for applications
that are not time critical and where the response time is not so important
(Embedded systems where missing deadlines are acceptable).
• It is very similar to a conventional procedural programming where the code is
executed task by task
• The tasks are executed in a never ending loop
• The task listed on top on the program code is executed first and the tasks just
below the top are executed after completing the first task
• A typical super loop implementation will look like:

1. Configure the common parameters and perform initialization for various


hardware components memory, registers etc
2. Start the first task and execute it
3. Execute the second task
4. Execute the next task
5. .
6. .
7. Execute the last defined task
8. Jump back to the first task and follow the same flow.
• The ‘C’ program code for the super loop is given below
void main ()
{
Configurations (); Initializations ();
while (1)
{
Task 1 ();
Task 2 ();
:
:
Task n ();
}
}
• Pros:

• Doesn’t require an Operating System for task scheduling and monitoring and
free from OS related overheads.

• Simple and straight forward design.

• Reduced memory footprint.


Cons:
• Non Real time in execution behavior (As the number of tasks increases the
frequency at which a task gets CPU time for execution also increases)
• Any issues in any task execution may affect the functioning of the product
(This can be effectively tackled by using Watch Dog Timers for task
execution monitoring)
Enhancements:
• Combine Super loop based technique with interrupts
• Execute the tasks (like keyboard handling) which require Real time
attention as Interrupt Service routines.
Embedded OS based Approach
• The embedded device contains an Embedded Operating System which can be one
of:

 A Real Time Operating System (RTOS)


 A Customized General Purpose Operating System (GPOS)
• The Embedded OS is responsible for scheduling the execution of user tasks and
the allocation of system resources among multiple tasks
• It Involves lot of OS related overheads apart from managing and executing user
defined tasks
• Microsoft® Windows XP Embedded is an example of GPOS for embedded
devices
• Point of Sale (PoS) terminals, Gaming Stations, Tablet PCs etc are examples of
embedded devices running on embedded GPOSs
• ‘Windows CE’, ‘Windows Mobile’,‘QNX’, ‘VxWorks’, ‘ThreadX’, ‘MicroC/OS-II’,
‘Embedded Linux’, ‘Symbian’ etc are examples of RTOSs employed in Embedded
Product development
• Mobile Phones, PDAs, Flight Control Systems etc are examples of embedded
devices that runs on RTOSs
Embedded firmware Development Languages
1. Assembly Language

2. High Level Language


 Subset of C (Embedded C)

 Subset of C++ (Embedded C++)

 Any other high level language with supported Cross-compiler

3. Mix of Assembly & High level Language


 Mixing High Level Language (Like C) with Assembly Code

 Mixing Assembly code with High Level Language (Like C)

 Inline Assembly
Assembly Language

• ‘Assembly Language’ is the human readable notation of ‘machine language’


• ‘Machine language’ is a processor understandable language
• Machine language is a binary representation and it consists of 1s and 0s Assembly
language and machine languages are processor/controller dependent
• An Assembly language program written for one processor/controller family will
not work with others
• Assembly language programming is the process of writing processor specific
machine code in mnemonic form, converting the mnemonics into actual processor
instructions (machine language) and associated data using an assembler
• The general format of an assembly language instruction is an Opcode followed by
Operands
• The Opcode tells the processor/controller what to do and the Operands provide the
data and information required to perform the action specified by the opcode
• It is not necessary that all opcode should have Operands following them. Some of
the Opcode implicitly contains the operand and in such situation no operand is
required. The operand may be a single operand, dual operand or more
• The 8051 Assembly Instruction MOV A, #30
• Assembly language instructions are written one per line
• A machine code program consists of a sequence of assembly language
instructions, where each statement contains a mnemonic (Opcode + Operand)
• Each line of an assembly language program is split into four fields as:
• LABEL OPCODE OPERAND COMMENTS
• LABEL is an optional field. A ‘LABEL’ is an identifier used extensively in
programs to reduce the reliance on programmers for remembering where data or
code is located. LABEL is commonly used for representing
• DELAY: MOV R0, #25 ; Load Register R0 with 25
• The symbol ; represents the start of a comment. Assembler ignores the text in a
line after the ; symbol while assembling the program
• DELAY is a label for representing the start address of the memory location where
the piece of code is located in code memory
• The above piece of code can be executed by giving the label DELAY as part of the
instruction. E.g. LCALL DELAY; LJMP DELAY
Assembly Language – Source File to Hex File
Translation:
• The Assembly language program written in assembly code is saved as .asm
(Assembly file) file or a .src (source) file or a format supported by the
assembler

• Similar to ‘C’ and other high level language programming, it is possible to


have multiple source files called modules in assembly language programming.
Each module is represented by a ‘.asm’ or ‘.src’ file or the assembler supported
file format similar to the ‘.c’ files in C programming

• The software utility called ‘Assembler’ performs the translation of assembly


code to machine code

• The assemblers for different family of target machines are different. A51 Macro
Assembler from Keil software is a popular assembler for the 8051 family micro
controller
• Each source file can be assembled separately to examine the syntax errors and
incorrect assembly instructions
• Assembling of each source file generates a corresponding object file. The object
file does not contain the absolute address of where the generated code needs to be
placed (a re-locatable code) on the program memory
• The software program called linker/locater is responsible for assigning absolute
address to object files during the linking process
• The Absolute object file created from the object files corresponding to different
source code modules contain information about the address where each instruction
needs to be placed in code memory
• A software utility called ‘Object to Hex file converter’ translates the absolute
object file to corresponding hex file (binary file)
Advantages:
1.Efficient Code Memory & Data Memory Usage (Memory Optimization):
 The developer is well aware of the target processor architecture and
memory organization, so optimized code can be written for performing
operations.
 This leads to less utilization of code memory and efficient utilization
of data memory.
2.High Performance:
 Optimized code not only improves the code memory usage but also
improves the total system performance.
 Through effective assembly coding, optimum performance can be
achieved for target processor.
3.Low level Hardware Access:
 Most of the code for low level programming like accessing external
device specific registers from OS kernel ,device drivers, and low level
interrupt routines, etc are making use of direct assembly coding.

4.Code Reverse Engineering:


 It is the process of understanding the technology behind a product by
extracting the information from the finished product.
 It can easily be converted into assembly code using a dis-assembler
program for the target machine.
Drawbacks:
1.High Development time:
 The developer takes lot of time to study about architecture ,memory
organization, addressing modes and instruction set of target
processor/controller.
 More lines of assembly code is required for performing a simple action.

2.Developer dependency:
 There is no common written rule for developing assembly language based

applications.
3.Non portable:
 Target applications written in assembly instructions are valid only for that
particular family of processors and cannot be re-used for another target
processors/controllers.
 If the target processor/controller changes, a complete re-writing of the
application using assembly language for new target processor/controller is
required.
High Level Language
• The embedded firmware is written in any high level language like C, C++
• A software utility called ‘cross-compiler’ converts the high level language to
target processor specific machine code
• The cross-compilation of each module generates a corresponding object file. The
object file does not contain the absolute address of where the generated code needs
to be placed (a re-locatable code) on the program memory
• The software program called linker/locater is responsible for assigning absolute
address to object files during the linking process
• The Absolute object file created from the object files corresponding to different
source code modules contain information about the address where each instruction
needs to be placed in code memory
• A software utility called ‘Object to Hex file converter’ translates the absolute
object file to corresponding hex file (binary file)
High Level Language – Source File to Hex File
Translation
Advantages:
• Reduced Development time: Developer requires less or little knowledge on
internal hardware details and architecture of the target processor/Controller.

• Developer independency: The syntax used by most of the high level languages
are universal and a program written high level can easily understand by a second
person knowing the syntax of the language

• Portability: An Application written in high level language for particular target


processor /controller can be easily be converted to another target
processor/controller specific application with little or less effort
Drawbacks:
• The cross compilers may not be efficient in generating the optimized
target processor specific instructions.
• Target images created by such compilers may be messy and non-
optimized in terms of performance as well as code size.
• The investment required for high level language based development
tools (IDE) is high compared to Assembly Language based firmware
development tools.
Mixing of Assembly Language with High Level
Language
• Embedded firmware development may require the mixing of Assembly Language
with high level language or vice versa.
• High Level language and low level language can be mixed in three different ways

 Mixing Assembly Language with High level language like ‘C’


 Mixing High level language like ‘C’ with Assembly Language
 In line Assembly
Mixing AssemblyLanguage with High level
language like‘C’
• Assembly routines are mixed with ‘C’ in situations where the entire program is
written in ‘C’ and the cross compiler in use do not have built in support for
implementing certain features like ISR.
• If the programmer wants to take advantage of the speed and optimized code
offered by the machine code generated by hand written assembly rather than cross
compiler generated machine code.
• For accessing certain low level hardware ,the timing specifications may be very
critical and cross compiler generated machine code may not be able to offer the
required time specifications accurately.
• Writing the hardware/peripheral access routine in processor/controller specific
assembly language and invoking it from ‘C’ is the most advised method.
Mixing ‘C’ and assembly is little complicated.

• The programmer must be aware of how to pass parameters from the ‘C’ routine to
assembly and values returned from assembly routine to ‘C’ and how Assembly
routine is invoked from the ‘C’ code.
• Passing parameter to the assembly routine and returning values from the assembly
routine to the caller ‘C’ function and the method of invoking the assembly routine
from ‘C’ code is cross compiler dependent.
• There is no universal written rule for purpose.
• We can get this information from documentation of the cross compiler.
• Different cross compilers implement these features in different ways depending on
GPRs and memory supported by target processor/controller
Mixing High level language like‘C’ with
Assembly Language
• The source code is already available in assembly language and routine written in a
high level language needs to be included to the existing code.

• The entire source code is planned in Assembly code for various reasons like
optimized code, optimal performance, efficient code memory utilization and
proven expertise in handling the assembly.

• The functions written in ‘C’ use parameter passing to the function and returns
values to the calling functions.
• The programmer must be aware of how parameters are passed to the function and
how values returned from the function and how function is invoked from the
assembly language environment.

• Passing parameter to the function and returning values from the function using
CPU registers , stack memory and fixed memory.

• Its implementation is cross compiler dependent and varies across compilers.


In line Assembly
• Inline assembly is another technique for inserting the target processor/controller
specific assembly instructions at any location of source code written in high level
language ‘C’
• Inline Assembly avoids the delay in calling an assembly routine from a ‘C’ code.
• Special keywords are used to indicate the start and end of Assembly instructions
E.g:
#pragma asm
Mov A,#13H
#pragma endasm
Interrupt

• An interrupt is a signal to the processor/ controller emitted by hardware or


software indicating an event that needs immediate attention.

• Whenever an interrupt occurs, the controller completes the execution of the


current instruction and starts the execution of an Interrupt Service Routine (ISR)
or Interrupt Handler.

• ISR tells the processor or controller what to do when the interrupt occurs. The
interrupts can be either hardware interrupts or software interrupts
• An interrupt is a signal (an “interrupt request”) generated by some event external
to the CPU
• In response to the interrupt, the routine or program, which is running presently
interrupts and an interrupt service routine (ISR) executes.

• There are two types of interrupts.


Hardware
Software
Hardware Interrupt

• A hardware interrupt is an electronic alerting signal sent to the processor from an


external device, like a disk controller or an external peripheral. For example, when
we press a key on the keyboard or move the mouse, they trigger hardware
interrupts which cause the processor to read the keystroke or mouse position.

• Hardware interrupts are triggered by peripheral devices outside the


processor/controller.
Hardware interrupt
• Examples ─ When a device or port is ready, a device or port generates an
interrupt, or when it completes the assigned action or when a timer overflows or
when a time at the timer equals a preset time in a compare register or on setting a
status flag (for example, on timer overflow or compare or capture of time) or on
click of mice in a computer

• Hardware interrupt generates call to an ISR


Software Interrupt
• A software interrupt is caused either by an exceptional condition or a
special instruction in the instruction set which causes an interrupt
when it is executed by the processor.

• For example, if the processor's arithmetic logic unit runs a command


to divide a number by zero, to cause a divide-by-zero exception, thus
causing the computer to abandon the calculation or display an error
message. Software interrupt instructions work similar to subroutine
calls.
• When software run-time exception condition defined in a program occurs, then a
software instruction (SWI) is executed─ called software interrupt or exception or
signal, which calls an ISR .

• When a device function is to be invoked, for example, open (initialize/configure)


or read or write or close , then a software instruction (SWI) is executed

• Software can execute the software instruction (SWI) or Interrupt n (INT n) to


signal execution of ISR (interrupt service routine). The n is as per the handler
address.

• Signal interrupt [The signal differs from the function in the sense that execution of
signal handler (ISR) can be masked and till mask is reset, the handler will not
execute on interrupt. Function on the other hand always executes on the call after a
call-instruction.]
• The state of continuous monitoring is known as polling. The microcontroller
keeps checking the status of other devices; and while doing so, it does no other
operation and consumes all its processing time for monitoring. This problem can
be addressed by using interrupts.

• In the interrupt method, the controller responds only when an interruption occurs.
Thus, the controller is not required to regularly monitor the status (flags, signals
etc.) of interfaced and inbuilt devices.
Interrupts v/s Polling

• An interrupt is like a shopkeeper. If one needs a service or product, he goes to


him and apprises him of his needs. In case of interrupts, when the flags or signals
are received, they notify the controller that they need to be serviced.

• The polling method is like a salesperson. The salesman goes from door to door
while requesting to buy a product or service. Similarly, the controller keeps
monitoring the flags or signals one by one for all devices and provides service to
whichever component that needs its service.
Interrupt Service Routine:
• Interrupt handling code often called an ISR (“Interrupt Service Routine”)
• When ISR is finished, execution returns to code running prior to interrupt.
• Interrupt Service Routines (ISR) are the portions of the program code that handle
the interrupt requests.
• When an Interrupt is triggered (either a hardware or software interrupt), the
processor breaks away from the current task, moves the instruction pointer to the
ISR, and then continues operation
• When the ISR has completed, the processor returns execution to the previous
location.
• Many embedded systems are called interrupt driven systems, because most of the
processing occurs in ISRs, and the embedded system spends most of its time in a
low-power mode
Latency
• The interrupt latency is the interval of time measured from the instant an interrupt
is asserted until the corresponding ISR begins to execute. The worst-case latency
for any given interrupt is a sum of many things, from longest to shortest:
• The longest period global interrupt recognition is inhibited
• The time it would take to execute all higher priority interrupts if they occurred
simultaneously
• The time it takes the specific ISR to service all of its interrupt requests (if multiple
are possible)
• The time it takes to finish the program instructions in progress and save the
current program state and begin the ISR
• We can see how higher-priority interrupts can have much lower latencies. In
simple cases, latency can be calculated from instruction times, but many modern
systems with 32-bit CPUs, caches, and multiple interrupt sources, are far too
complex for exact latency calculations. Interrupt latency must be considered at
design time, whenever responsiveness matters.
Interrupt Vector Table
• Constant table in ROM.
• Special addresses with respect to CPU.
• Each interrupt has specific address in interrupt vector table .
• This specific address should be programmed to have the address of ISR of this
interrupt.
• At interrupt processing PC will contain this address or it will be an instruction to
jump to this address
Direct Memory Access (DMA)

Direct Memory Access (DMA)

• Direct memory access (DMA) is a mode of data transfer between the memory
and I/O devices.

• This happens without the involvement of the processor.

• We have two other methods of data transfer, programmed I/O and Interrupt
driven I/O.
• In programmed I/O, the processor keeps on scanning whether any device is
ready for data transfer. If an I/O device is ready, the processor fully dedicates itself
in transferring the data between I/O and memory. It transfers data at a high rate,
but it can’t get involved in any other activity during data transfer. This is the
major drawback of programmed I/O.

• In Interrupt driven I/O, whenever the device is ready for data transfer, then it
raises an interrupt to processor. Processor completes executing its ongoing
instruction and saves its current state. It then switches to data transfer which
causes a delay. Here, the processor doesn’t keep scanning for peripherals ready for
data transfer. But, it is fully involved in the data transfer process. So, it is also not
an effective way of data transfer.
Without DMA vs With DMA

Without DMA With DMA

When the CPU is using programmed The CPU initiates the transfer, does other
input/output, it is typically fully operations while the transfer is in
occupied for the entire duration of the progress, and receives an interrupt from
read or write operation, and is thus the DMA controller when the operation
unavailable to perform other work. is done.
• The two methods of data transfer are not useful for transferring a large block of
data. But, the DMA controller completes this task at a faster rate and is also
effective for transfer of large data block.
• The DMA controller transfers the data in three modes

• Burst Mode
• Cycle Stealing Mode
• Transparent Mode
• Burst Mode: Here, once the DMA controller gains the charge of the system bus,
then it releases the system bus only after completion of data transfer. Till then the
CPU has to wait for the system buses

• Cycle Stealing Mode: In this mode, the DMA controller forces the CPU to stop
its operation and relinquish the control over the bus for a short term to DMA
controller. After the transfer of every byte, the DMA
controller releases the bus and then again requests for the system bus. In this way,
the DMA controller steals the clock cycle for transferring every byte.

• Transparent Mode: Here, the DMA controller takes the charge of system bus
only if the processor does not require the system bus.
DMA Data Tranfer: Block Diagram
DMA Data Tranfer
• Two control signals are used to request and acknowledge a DMA transfer .
• The HOLD signal is a bus request signal which asks the microprocessor to release
control of the buses after the current bus cycle.
• The HLDA signal is a bus grant signal which indicates that the microprocessor has
indeed released control of its buses by placing the buses at their high-impedance
states.
• DREQ (DMA request): Used to request a DMA transfer for a particular
DMAchannel.
• DACK (DMA channel acknowledge): Acknowledges a channel DMArequest from
a device.
DMA Data Transfer
• Data transfer technique directly between memory and I/O deviceSteps:

1.I/O device asserts DRQ signal.


2.DMA controller sends HOLD signal to CPU
3.CPU sends HLDA back to DMA controller
4.DMA controller give DMA acknowledgment back to I/O.
5.DMA controller places memory address on address bus
6.DMA controller updates memory address register and word counter register
7.When DC register becomes zero ,DMA controller sets HOLD=0
8.Data transfer process terminates and processor regain control of system bus.
Advantages of DMA
• DMA allows a peripheral device to read from/write to memory without going
through the CPU
• DMA allows for faster processing since the processor can be working on
something else while the peripheral can be populating memory.
Disadvantages of DMA
• DMA transfer requires a DMA controller to carry out the operation, hence cost of
the system increases.
• Cache Coherence problems.
Device driver definition

• A device driver has a set of routines (functions) used by a high-level language


programmer, which does the interaction with the device hardware, sends control
commands to the device, communicates data to the device and runs the codes for
reading device data.
• Each device in a system needs device driver routine with number of device
functions.

• An ISR relates to a device driver command (device-function). The device driver


uses SWI to call the related ISR (device-function routine)

• The device driver also responds to device hardware interrupts.

• A programmer uses generic commands for device driver for using a device. The
operating system provides these generic commands.

• Each command relates to an ISR. The device driver command uses an SWI to call
the related ISR device-function routine)
• Generic functions used for the commands to the device are device

• create ( )
• open ( )
• connect ( )
• bind ( )
• read ( )
• write ( )
• ioctl ( ) [for IO control]
• delete ( )
• close ( )
Concept of C vs Embedded C
C Language:
• C is a general-purpose programming language, which is widely used to design any
type of desktop-based applications.

• It was developed by Dennis Ritchie as a system programming language to


develop the operating system.

• The main features of C language include low-level access to memory, a simple set
of keywords, and clean style, these features make C language suitable for system
programming like OS or compiler development.
Embedded C:
• Embedded C is an extension of C language and it is used to develop micro-
controller based applications.

• The extensions in the Embedded C language from normal C Programming


Language is the I/O Hardware Addressing, fixed-point arithmetic operations,
accessing address spaces, etc. Embedded C Program has five layers of Basic
Structures.
C vs Embedded C
C Embedded C
C is a general purpose programming language, which can Embedded C is simply an extension C language and it is used
be used to design any type of desktop based applications. to develop micro-controller based applications.

It is a type of high level language It is nothing but an extension of C.

C language is hardware independent language. Embedded C is fully hardware dependent language.

For C language, the standard compilers can be used to For Embedded C, a specific compilers that are able to generate
compile and execute the program. particular hardware/micro-controller based output is used.

Popular Compiler to execute a C language program Popular Compiler to execute a Embedded C language program
are:GCC (GNU Compiler collection),Borland turbo C, are: Keil compiler, BiPOM ELECTRONIC, Green Hill
Intel C++ software
C Embedded C
It is very easy to read and modify the C language. It is not easy to read and modify the Embedded C language.

Bug fixing are very easy in a C language program. Bug fixing is complicated in a Embedded C language
program.

C language has a free-format of program coding. Formatting depends upon the type of microprocessor that is
used.

Input can be given to the program while it is running. Only the pre-defined input can be given to the running
program.

Applications of C Program: Applications of Embedded C Program:


Logical programs DVD
System software programs TV
Digital camera
Difference Between Compiler and Cross Compiler
• The main difference between compiler and cross compiler is that the compiler is a
software that transforms a computer program written in high-level programming
language into machine language while the cross compiler is a type of a compiler
that can create an executable code for a platform other than the one on which the
compiler is running.
What is a Compiler
• A computer program consists of a set of instructions for the computer to perform a
specific task.

• Most computer programs are written using high-level programming languages.


Thus, the computer does not understand these programs.

• Therefore, they are converted to machine understandable, machine language.

• A compiler is a software that performs this conversion. It converts the source


program into machine code.

• A compiler translates the whole program into machine code at a time.


What is a Cross Compiler
• A cross compiler is a type of compiler. This type of compilers can create an
executable code for a platform other than the one on which the compiler is
running.

• For example, a compiler that runs on Windows platform also generates a code that
runs on Linux platform is a cross compiler.

• The process of creating executable code for a different machine is also


called retargeting.

• Therefore, the cross compiler is also known as a retargetable compiler.


• The main difference between compiler and cross compiler is that the compiler is
software that transforms the computer program written in a high level
programming language into the machine language while cross compiler is a type
of a compiler that is capable of creating executable code for various platforms.

You might also like