You are on page 1of 154

IC615 EMBEDDED SYSTEMS

EMBEDDED SYSTEM?
 It is a microcontroller or microprocessor based system
to perform a dedicated task.

 It has application software embedded on it. The


application software running on the hardware control
its functioning (Firmware)

 It
may be a subsystem - closely integrated with the
main(large) system – Car ignition control

 Itmay be an independent system or stand alone


system – It does not require a host system and it can
work by itself
EMBEDDED SYSTEMS
Basic structure of Embedded system
EMBEDDED SYSTEMS
Microprocessor
based system
EMBEDDED SYSTEMS
Microcontroller
based system
EMBEDDED SYSTEMS
EMBEDDED SYSTEMS
Performance requirement based systems
 Stand alone embedded systems do not require a host
system like a computer, it works by itself.

 It takes the input from the input ports either analog


or digital and processes, calculates and converts the
data and gives the resulting data through the
connected device-which either controls, drives and
displays the connected devices.
EMBEDDED SYSTEMS
Performance requirement based systems
 Real time Embedded systems give a required output in a
particular time.

 These types of embedded systems follow the time deadlines


for completion of a task.

 Real time embedded systems are classified into two types


such as soft and hard real time embedded systems.
Soft Real time system – Must try to meet the deadlines,
and system does not fail if deadline missed.
Hard Real time system – Must meet the deadline and the
system fails if deadline missed
EMBEDDED SYSTEMS
Performance based systems
 Networked Embedded Systems are related to a network to
access the resources.

 The connected network (wired or wireless) can be LAN,


WAN or the internet.

 The embedded web server is a type of system wherein all


embedded devices are connected to a web server and
accessed and controlled by a web browser.

 The LAN networked embedded system is a home


automation system wherein all sensors are connected and
run on the protocol TCP/IP
EMBEDDED SYSTEMS
Performance requirement based systems
 Networked Embedded Systems are related to a network to
access the resources.

 The connected network (wired or wireless) can be LAN,


WAN or the internet.

 The embedded web server is a type of system wherein all


embedded devices are connected to a web server and
accessed and controlled by a web browser.

 The LAN networked embedded system is a home


automation system wherein all sensors are connected and
run on the protocol TCP/IP
EMBEDDED SYSTEMS
Performance requirement based systems
 Mobile Embedded Systems are used in portable
embedded devices like cell phones, mobiles, digital
cameras, mp3 players and personal digital assistants,
etc.

 The basic limitation of these devices is the resources


and limitation of memory.
EMBEDDED SYSTEMS
Microcontroller performance based systems
 Small Scale Embedded Systems are designed with a
single 8 or 16-bit microcontroller, that may even be
activated by a battery.

 For developing embedded software for these systems,


the main programming tools are an editor, assembler,
cross assembler and integrated development
environment (IDE).
EMBEDDED SYSTEMS
Microcontroller performance based systems
 Medium Scale Embedded Systems designed with a 16
or 32 bit microcontroller, Reduced Instruction Set
Computation (RISC) or Digital signal Processors (DSPs).

 These types of embedded systems have both hardware


and software complexities.

 For developing embedded software for medium scale


embedded systems, the main programming tools are C,
C++, JAVA, Visual C++, Real time operating system
(RTOS) - optional, debugger, source code engineering
tool, simulator and IDE.
EMBEDDED SYSTEMS
Microcontroller performance based systems
 Sophisticated Embedded Systems have enormous
hardware and software complexities.

 It may need application-specific instruction set processor


(ASIPs), Programmable Logic Arrays (PLAs), scalable or
configurable processors.

 They are used for cutting-edge applications that need


hardware and software Co-design and components
which have to assemble in the final system.
EMBEDDED SYSTEMS

 Domestic appliances
 Mobile phone units

 Data switches

 Satellites

 Networking

 Automated measurements and controls


EMBEDDED SYSTEMS
EMBEDDED SYSTEMS
EMBEDDED SYSTEMS
Embedded System

 Embedded system means the processor is


embedded into that system (application).
 An embedded system uses a microprocessor or
microcontroller to do one task only.
 In an embedded system, there is only one
application software that is typically burned into
ROM.
 Example printer, keyboard, video game player
A TYPICAL EMBEDDED SYSTEM

 A typical embedded system would have:


 A micro-controller to provide the “intelligence”

 Interfacing circuits to connect with the main


application
 Real time software

 Dedicated hardware for functions whose


implementation in software might be too slow

 Test and maintenance hardware


DESIGN OF EMBEDDED SYSTEMS

 Task partitioning between hardware and software

 Hardware design and integration

 Software development

 System integration

 Test strategies
HOW ARE EMBEDDED MICRO-CONTROLLER SYSTEMS
DIFFERENT?

 An embedded micro-controller runs a single program


which never terminates!

 There is no (separate) operating system – the operating


system has to be merged with the application program.

 Most embedded micro-controllers have to respond in real


time.

 In practice, all embedded systems are resource


constrained. For example, an 8051 based system has
only 128 bytes of RAM 8052 based system 256 bytes of
RAM etc.
Criteria in Choosing a Microcontroller
 Meeting the computing needs of the task
efficiently and cost effectively
• speed, the amount of ROM and RAM, the number
of I/O ports and timers, size, packaging, power
consumption
• easy to upgrade
• cost per unit
 Availability of software and Hardware
development tools
• assemblers, debuggers, C compilers, emulator,
simulator, technical support
 Wide availability and reliable sources of the
microcontrollers.
TYPES OF EMBEDDED SYSTEMS
 Classified by
 Word size (4-64 bit)‫‏‬
 Type of hardware
 Embedded Microcontroller

 External-Memory Microcontroller

 Microprocessor

 Operating System?

• Embedded Microcontroller

• Just add software (and power, and reset, and a


clock)‫‏‬
• ALU, RAM, ROM & peripheral interfaces all on
board
Embedded systems
 TARGET BOARD - Microcontroller
• smaller computer
• On-chip RAM, ROM, I/O ports, Serial Port, Timer, ...
• Example 8051 controllers, Motorola’s 6811,, Zilog’s
Z8 and PIC 16X, 17X,18X...

CPU RAM ROM


A single chip
Serial Microcontroller
I/O Timer COM
Port Port
TARGET BOARD HARDWARE
ARCHITECTURE OF 8051
FEATURES OF THE 8051 MICROCONTROLLER
Feature Quantity
ROM 4K Bytes
RAM 128 Bytes
Timer 2
I/O Ports 4
Serial Port 1
Interrupt Sources 6

 The
8051 is the original member of the Intel
MCS-51 family of Microcontrollers.
 There are several varieties that differ slightly in
the available features.
MCS-51 VARIANTS
Feature 8051 8052 8751 8752 8031 8032
EPROM
On-Chip ROM 4K 8K 4k 8k 0K 0K
RAM (Bytes)‫‏‬ 128 256 128 256 128 256
Timers 2 3 2 3 2 3
I/O Ports 4 4 4 4 2 2
Serial Port 1 1 1 1 1 1
Interrupt Sources 6 8 6 8 6 8
 The 8031 requires external instruction memory.
 It can be as large as 64K Bytes.
 You lose 2 ports for interfacing to the external memory.
 You can replace these by interfacing the chip to an I/O port
controller like the 8255 (Programmable Peripheral Interface).
MANUFACTURERS OF MCS-51 CLONES
 Dallas Semiconductor
 Uses NV-RAM. Programmable in-system.
 As large as 32K of instruction memory.

 Some versions have an on-chip REAL-TIME CLOCK.

 Philips Corporation.
Large selection of 8051 based
microcontrollers.
Include features like A/D and D/A on chip.

 Xilinx and Altera


 8051 Field Programmable Gate Array (FPGA) cores.
TARGET ARCHITECTURE
8051 Microcontroller
PIN OUT OF THE 8051
 40 pin package
 32 pins are used for the 4 ports.
 VCC / VSS
 RST
 ALE
 Address Latch Enable

 EA / VPP
 External Address
 Program Voltage for EPROM based
versions of the 8051.
 XTAL1 and XTAL2
 Connections for clock crystal.

 PSEN
 “Program Store Enable”
 Read signal for external program
memory
8051 MEMORY
MEMORY ARCHITECTURE
 Two types of Computer Architecture: Von Neumann
Architecture and Harvard Architecture.

Von Neumann Architecture


 Von Neumann Architecture or Princeton Architecture
is a Computer Architecture, where the Program i.e.
the Instructions and the Data are stored in a single
memory.
 Since the Instruction Memory and the Data Memory
are the same, the Processor or CPU cannot access
both Instructions and Data at the same time as they
use a single bus.
MEMORY ARCHITECTURE
Von Neumann Architecture
MEMORY ARCHITECTURE
Harvard Architecture
 Harvard Architecture, in contrast to Von Neumann
Architecture, uses separate memory for Instruction
(Program) and Data.

 Since the Instruction Memory and Data Memory are


separate in a Harvard Architecture, their signal paths
i.e. buses are also different and hence, the CPU can
access both Instructions and Data at the same time.
 Almost all Microcontrollers, including 8051
Microcontroller implement Harvard Architecture.
MEMORY ARCHITECTURE
Harvard Architecture
MEMORY ARCHITECTURE
8051 Memory Organization
 The 8051 Microcontroller Memory is separated in
Program Memory (ROM) and Data Memory (RAM).
The Program Memory of the 8051 Microcontroller is
used for storing the program to be executed i.e.
instructions.
 The Data Memory on the other hand, is used for
storing temporary variable data and intermediate
results.
 8051 Microcontroller has both Internal ROM and
Internal RAM. If the internal memory is inadequate,
you can add external memory using suitable
circuits.
MEMORY RANGE
 No of Address lines – 16 – Memory size – 216 = 64K
 No of Data lines – 8 bits = Word size = 1 byte
MEMORY RANGE
 10 address lines - 1K memory
 11 address lines - 2K memory

 12 address lines - 4K memory

 13 address lines - 8K memory

 14 address lines - 16K memory

 15 address lines - 32K memory

 16 address lines - 64k memory

 17 address lines - 128K memory

 18 address lines - 256K memory

 19 address lines - 512K memory

 20 address lines - Now 1Mega Bytes memory -1M.


CODE MEMORY (ROM)
 Holds the actual 8051 program that is to be run.
 It is possible to have:
 4K of code memory on-chip

 64k of code memory off-chip in an EPROM.

-When the program is stored on-chip, the 64K


maximum is often reduced to 4k, 8k, or 16k.
 In low-cost development systems code memory is
most commonly implemented as off-chip EPROM.
 Non-volatile and Reprogrammable memory
CODE MEMORY (ROM-Flash)
 In case of 4KB of Internal ROM, the address space is
0000H to 0FFFH.
 If the address space i.e. the program address
exceeds 0FFFH value, then the CPU will
automatically fetch the code from the external
Program Memory.
 For this, the External Access Pin (EA Pin) must be
pulled HIGH i.e. when the EA Pin is high, the CPU
first fetches instructions from the Internal Program
Memory in the address range of 0000H to 0FFFFH
and if the memory addresses exceed the limit, then
the instructions are fetched from the external ROM in
the address range of 1000H to FFFFH.
CODE MEMORY (ROM)
CODE MEMORY (ROM) - External
 The CPU fetches all the instructions only from the
External Program Memory (External ROM).

 For this scenario, the EA Pin must be connected to


GND. In this case, the memory addresses of the
external ROM will be from 0000H to FFFFH.
READ ONLY MEMORY
DATA MEMORY - Internal RAM
 Limited to 128 bytes (256 bytes with an 8052)‫‏‬
 Found on-chip on the 8051
 Fastest RAM available
 Flexible
in terms of reading, writing, and
modifying‫‏‬it’s‫‏‬contents.
 Internal RAM is volatile
 Sowhen the 8051 is reset this memory is
cleared.
DATA MEMORY - Internal RAM
DATA MEMORY - Internal RAM
External RAM
 The 8051 supports External RAM up to 64K
 External RAM is any random access memory found
off-chip.
 Not flexible in terms of accessing
 Slower.
EXTERNAL ROM AND RAM
MEMORY
 Many different types that vary in
 Access speed.
 Volatility.
 Erasability.
 Cost
 As a rule of thumb, the more useful the memory
technology is, the more expensive it would be.
 RAM – Random Access Memory
 Dynamic – DRAM
 Static – SRAM

 ROM – Read Only Memory


 Erasable – EPROM
 Electrically Erasable – EEPROM
MEMORY – SPEED

 The speed of memory is measured by two


numbers:
 Access Time.
 How long it takes from the time the address is ready until
the data becomes ready.

 Cycle Time.
 How soon after the previous access can the memory be
accessed again.
MEMORY – RAM
 Allows both read and write operations.
 Both operations are performed electrically.
 Volatile.
 Used for temporary storage only.
 If the power is disconnected, the contents become
invalid.
 Can be made non-volatile by using a battery for
backup power.
RAM TYPES
Dynamic RAM

In dynamic RAM chip, each memory cell holds


one bit of information and is made up of two parts:
a transistor and a capacitor.
These are, of course, extremely small transistors and
capacitors so that millions of them can fit on a single
memory chip.
The capacitor holds the bit of information -- a 0 or a 1.
The transistor acts as a switch that lets the control
circuitry on the memory chip read the capacitor or
change its state.
RAM TYPES
 Dynamic RAM
A capacitor - To store a 1 – Fully charged
To store 0 - it is emptied.
 The problem with the capacitor's bucket is that it
has a leak. In a matter of a few milliseconds a full
bucket becomes empty. Therefore, for dynamic
memory to work, either the CPU or the memory
controller has to come along and recharge all of
the capacitors holding a 1 before they discharge.
 To do this, the memory controller reads the
memory and then writes it right back. This refresh
operation happens automatically thousands of
times per second.
RAM TYPES
 Static RAM
 It has Flip Flops to store the bit information
 A flip-flop for a memory cell takes 4 or 6 transistors
along with some wiring, but never has to be
refreshed.
 The static RAM significantly faster than dynamic
RAM. However, because it has more parts, a static
memory cell takes a lot more space on a chip than
a dynamic memory cell. Therefore you get less
memory per chip, and that makes static RAM a lot
more expensive.
 So static RAM is fast and expensive, and
dynamic RAM is less expensive and slower.
Therefore static RAM is used to create the CPU's
speed-sensitive cache, while dynamic RAM forms
the larger system RAM space.
MEMORY – EPROM
 Uses
MOS transistors with insulating
material that changes behaviour when
exposed to ultraviolet light.
 Programmed electrically and erased optically.
 Erasing can be repeated a relatively large but
limited number of times (~100,000 times).
 Erasing time ~20 minutes.

 Electrically read and written.


 Before writing, ALL cells must be erased by
exposure to ultraviolet light.
 Non volatile.
 More expensive than PROM.
MEMORY – EEPROM
 Uses the same floating-gate transistors, except that
the insulating material is much thinner.
 Its operation can be inverted using voltage.
 Can be written to any time without erasing the
previous contents.
 Only the bytes addressed are modified.
 Write takes a relatively long time
(~100sec/byte).
 Can be erased only about 10,000 times.
 Non volatile.
MEMORY – THE STACK
 The stack is an area of memory identified by the
programmer for temporary storage of information.
 The stack is a LIFO structure.
 Last In First Out.
 The stack normally grows backwards into memory.
In other words, the programmer
defines the bottom of the stack
and the stack grows up into
reducing address range. Memory

The Stack Bottom


3 of the
grows 2
backwards Stack
1
into memory
MEMORY – THE STACK
 Processorsusually contain a special
register known as the Stack Pointer (SP).
 This pointer is used to constantly point to the “top of
the stack.”
 Information is saved on the stack using a “push”
operation.
 The information is copied to the location pointed to by the SP, then
the SP is decremented.
 Information is retrieved from the stack using a
“pop” operation.
 The SP is incremented, then the information is copied from the
location pointed to by the SP.
 There must be a pop for every push.
MEMORY - CACHE
 Cache memory is a memory used by the CPU to
decrease the time. It is relatively smaller and a
faster memory. Which stores most often accessed
data of the primary memory. When there's a
request for a memory read, cache memory is
checked to see whether that data is present in
cache memory.
 If information is in the cache memory, then there's
no need to get the main memory (which requires a
longer time to be obtained), therefore making the
average memory access time bigger. There are
caches for instructions and data. Data cache is
typically installed in a hierarchy of cache levels
(sometimes called multilevel caches).
MEMORY – RAM VS CACHE
MEMORY - DMA
 Direct Memory Access (DMA)
 Direct Memory Access is feature of computer
hardware that allows devices to gain access to the
main bus linking the processor to the system
memory and move data directly between the main
memory and another part of the system.

 A dedicated DMA controller, often integrated in


the processor, can be configured to move data
between main memory and a range of subsystems,
including another part of main memory.
MEMORY - DMA
 Direct Memory Access (DMA) Controller
 If the device produces or consumes a small amount of data at
low data rates, this may be the best way of managing the data
transfer in and out of main memory; in fact, for some devices
such as simple UARTs this may be the only way. However,
using programmed i/o has some limitations: first of all, the fact
that programmed i/o involves a software loop may limit its
performance. Secondly, for many systems this is not a good use
of processing time as the processor may be spending more time
than is necessary or available moving data between main
memory and its external interfaces.
 The alternative is to set up a DMA transfer that gives the job of
moving the data to a special-purpose device in the system. Once
the processor has set up the transfer it can do something else
while the transfer is in progress or wait to be notified when the
transfer has finished. For example, the same transfer to the
UART that was done using programmed i/o in the example
above could be done using the system’s DMA controller, which
would free up the processor to do other work while the transfer
was in progress.
MEMORY - DMA
 Direct Memory Access (DMA) Controller
TIMING AND COUNTING MODULE
Software developed Timing
TIMING AND COUNTING MODULE
Software implemented
TIMING AND COUNTING MODULE
 Some of the input and output devices commonly used
in embedded systems.
 Few are often found as on-chip devices in micro-
controllers;
 Few are generally implemented separately but are
still commonly used.

 Examples : ADC, DAC, Timer, Counter, Real Time


Clock (RTC), watchdog timer...
TIMING AND COUNTING MODULE
Hardware implemented
 A timer is a specialized type of clock which is used to
measure time intervals.
 A timer uses the frequency of the internal clock, and
generates delay.

 A counter is a device that stores (and sometimes


displays) the number of times a particular event or
process occurred, with respect to an input signal. It is
used to count the events happening outside the
microcontroller.
 A counter uses an external signal to count pulses.
TIMING AND COUNTING MODULE
Timer Module
Steps to be followed for Timer operation
1. Load the initial count in the timer register

2. Start (Run) the timer

3. It starts counting from the initial count, until


reaches the maximum value.

4. Reaching the maximum count in the timer


register, it generates the required delay.
TIMING AND COUNTING MODULE
Timer – Tick time
 The regular time interval at which timer count is
incremented

 The time interval (Δt) is defined by the internal


system clock. Δt= 1\(inter clock Frequency)

 The timer works with a clock frequency of 1/12 of the


XTAL frequency; therefore, we have 11.0592 MHz /
12 = 921.6 kHz as the timer frequency.
 As a result, each clock has a period of T = 1/921.6kHz
= 1.085μs.
 In other words, Timer counts up each 1.085 μs
resulting in delay = number of counts × 1.085 μs.
TIMING AND COUNTING MODULE
The 8051 family controllers has

• Two 16-bit Counter/Timers


– Up counters can interrupt on overflow
• Counts:
– CPU cycles (crystal / 12)

The Timer module is accessed through THx, TLx


registers, TMOD and TCON registers.
TIMING AND COUNTING MODULE
TMOD: Counter Timer Mode Register

GATE C/T M1 M0 GATE C/T M1 M0


TIMER 1 TIMER 0
GATE Permits INTx pin to enable/disable counter
C/T Set for counter operation, reset for timer operation
M1, M0
00 Emulate counter/timer
01 16-bit counter/timer
10 8-bit auto-reload mode
11 Timer 0 = two 8-bit timers
Timer 1 = stopped
TIMING AND COUNTING MODULE
TCON : Counter/Timer Control Register

TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0


TF1, TF0 Overflow flags for Timer 1 and Timer 0
TR1, TR0 Run control bits for Timer 1 and Timer 0
Set to run, reset to hold
IE1, IE0 Edge flag for external interrupts 1 and 0 *
(Set by interrupt edge H to L)
IT1, IT0 Type bit for external interrupts *
Set for falling edge interrupts, reset for
0 level interrupts
* Not related to counter/timer operation
TIMING AND COUNTING MODULE
TIMING AND COUNTING MODULE
TIMING AND COUNTING MODULE
Uses of Timer devices
 Initiating an event after a preset delay time.
Delay is as per count value loaded.
 Initiating an event (or a pair of events or a
chain of events) after a comparison(s)
between the pre-set time with counted value.
 A preset time (count) is loaded in a Compare
Register.
 Capturing the count value at the timer on an
external event. Time stamp
TIMING AND COUNTING MODULE
Uses of Timer devices
 Baud rate or Bit Rate Control for serial
communication on a line or network. Timer
timeout interrupts define the time of each baud

 Wait for a message from queue or mailbox or


semaphore for a preset time when using
RTOS. There is a predefined waiting period is
done before RTOS lets a task run.

 Scheduling of various tasks


TIMING AND COUNTING MODULE
 Time slicing of various tasks. A multitasking
or multi-programmed operating system
presents the illusion that multiple tasks or
programs are running simultaneously by
switching between programs very rapidly,
for example, after every 10 milliseconds.

 Process known as a context switch. [RTOS


switches after preset time-delay from one
running task to the next. task. Each task can
therefore run in predefined slots of time]
TIMING AND COUNTING MODULE
Uses of Timer devices

 Input pulse counting when using a timer, which


is ticked by giving non-periodic inputs instead
of the clock inputs.

 Thetimer acts as a counter if, in place of clock


inputs, the inputs are given to the timer for
each instance to be counted.
TIMING AND COUNTING MODULE
Uses of Timer devices

 Time division multiplexing (TDM) - Timer device


used for multiplexing the input from a number of
channels.

 Each channel input allotted a distinct and fixed-


time slot to get a TDM output.

 System Clock - used to control the schedules and


timings in the system
TIMING AND COUNTING MODULE
Watch Dog Timer
 A timing device that used to set for a
preset time interval and an event must
occur during that interval, else the device
will generate the timeout signal on failure
to occur that event in the watched time
interval.
 On that event occurance, the watchdog
timer is disabled for generation of timeout
or reset
 Timeout may result in processor starting
a service routine or start from beginning
TIMING AND COUNTING MODULE
Watch Dog Timer
 Assume that we anticipate that a set of tasks
must finish in 100 ms interval.

 The watchdog timer is disabled and stopped by


the program instruction in case the tasks finish
within 100 ms interval.

 In case task does not finish (not disabled by a


program instruction), watchdog timer generates
interrupts after 100 ms and executes a routine,
which is programmed to run because there is
failure of finishing the task in anticipated
interval.
TIMING AND COUNTING MODULE
Real time clock
 A clock based on the interrupts at preset
intervals

 An interrupt service routine executes on


each timeout (overflow) of this clock

A timing device once started never resets


or never reloaded with another value

 Once it is set, it is not modified later.


TIMING AND COUNTING MODULE
Real time clock
 Used in a system to save the time and
date.

 Usedin a system to initiate return of


control to the system (OS) after the set
system clock period
TIMING AND COUNTING MODULE
Real time clock
 Assume that a hardware timer of an RTC
for calendar is programmed to interrupt after
every 5.15 ms (=1 day period/ 224)

 Assume each tick (interrupt) a service


routine runs and updates at a memory
location. Within one day (86400 s) there will
be 224 ticks, the memory location will reach
0x000000 after reaching the maximum
value 0xFFFFFF.
HARDWARE / SOFTWARE DEVELOPMENT OR
TESTING TOOLS
HARDWARE TESTING TOOLS

 Even though firmware is bug free embedded


product need not function as per expected
behaviour.

 This is because of dry soldering, missing


connections, un-noticed errors in PCB etc.

 Debugging the target board is the only way to


sort out these issues.
HARDWARE TESTING TOOLS
Hardware debugging involves

 Monitoring various signals of target board.

 Checking connection between components.

 Circuit continuity checking.


HARDWARE TESTING TOOLS
Hardware debugging tools are

 Magnifying Glass(Lens)
 Multimeter
 Digital CRO
 Logic Analyzer
 Function Generator
HARDWARE TESTING TOOLS
Magnifying Glass(lens)
 It is a visual inspection
tool.
 Surface of target board can
be examined for dry
soldering, improper
soldering, track damage
etc..
 Magnifying station may
incorporate multiple lens.
 Main lens acts as visual
inspection tool.
 Other small lens is used for
magnifying small area of
the board for thorough
inspection.
HARDWARE TESTING TOOLS
Multimeter
 Mutimeter is used for
measuring various
electrical quantities.
 Primary debugging tool for
physical contact based
hardware debugging.
 Mainly used for checking
circuit continuity, signal
value, polarity, measuring
supply voltage.
 Both analog and digital
versions are available.
 Digital versions have
better readability and
accuracy.
HARDWARE TESTING TOOLS
Oscilloscope
 CRO is used for waveform
capturing and analysis,
measurement of signal
strength etc.

 It is a very good tool in


analysing interference noise
in power line and other signal
lines.

 They are available in both


analog and digital form.

 Digital CROs are suitable for


high frequency support and
best suited or target board
debugging.
HARDWARE TESTING TOOLS
Logic Analyser
 Used for capturing
digital data from digital
circuitry.
 It contains special
connectors and clips
attached to target board.
 It captures states of
various port pins,
address bus and data bus
of target processor.
 Logic analyzers give
exact reflection of what
happens when the
firmware is running.
HARDWARE TESTING TOOLS
Logic Analyser
HARDWARE TESTING TOOLS
Function generator
 It is an input signal
simulator tool.
 It is capable of producing
various periodic waveforms
like sine, square, sawtooth
waves.
 The waveforms are of
different frequencies and
amplitudes.
 In debugging environment,
the function generator
 serves the purpose of
generating and supplying
required signals
SOFTWARE DEVELOPMENT TOOLS
Host and Target Machine
 Host is the computer on
which all the programming
tools are run
 Target is the Hardware for
which the application is
developed
 Application programs are
developed, compiled,
linked and run on host.
 The created executable
Hex/Binary is moved to
target
SOFTWARE DEVELOPMENT TOOLS
Assembler Compiler
 An Assembler is software  A software program that
program that converts converts source code that in
source code written in high level programming
assembly language into language into low level
machine language. language.
 Native-compiler runs on a
 The input to the Assembler computer platform and
must be assembly language produces code for that same
computer platform
 An Assembler that runs on  A Cross-compiler runs on one
Host but produces binary computer platform and
instruction appropriate for produces code for another
Target is called Cross computer platform.
Assembler.
SOFTWARE DEVELOPMENT TOOLS
Linker
 A linker or link editor is a program that takes one or
more objects files generated by compilers and
assembles them into a single executable program
or a library that can later be linked to in itself.

 All of the object files resulting from compiling must


be combined before the program can be executed.
SOFTWARE DEVELOPMENT TOOLS
Locator
 It performs the conversion from relocatable
program to executable binary image.

 It will produce an output file that contains a binary


image that can be loaded into the target ROM.

 You will have to provide information about the


memory on the target board as input to the locator.

 The locator uses this information to assign physical


memory addresses to each of the code and data
sections.
SOFTWARE DEVELOPMENT TOOLS
Debugger
Debugging is a process to find and reduce the number of
bugs in a computer program. The debugging tools used
in embedded systems differ greatly in terms of their
development time and debugging features.

 It is a computer program that is used to test and


debug the application programs.

 When the program crashes, the debugger shows the


actual position in the original code if it is a source-level
debugger.

 If it is a low-level debugger or a machine-language


debugger it shows that line in the program.
SOFTWARE DEVELOPMENT TOOLS
Simulator
Code is tested for the MCU / system by simulating it
on the host computer used for code development.
Simulators try to model the behaviour of the
complete microcontroller in software.

A simulator can not talk to the target system, so


functions that rely on external components are
difficult to verify.
SOFTWARE DEVELOPMENT TOOLS
Emulator
 An emulator is a piece of hardware that ideally
behaves exactly like the real microcontroller chip
with all its integrated functionality. It is the most
powerful debugging tool of all. A microcontroller's
functions are emulated in real-time.
 All emulators contain 3 essential functions in
different implementation forms:
 The emulator control logic, including emulation memory
 The actual emulation device
 A pin adapter that gives the emulator's target connector
SOFTWARE DEVELOPMENT TOOLS
INTRODUCTION TO C PROGRAMMING
Introduction
 C was invented and first implemented by Dennis Ritchie
on a DEC PDP-11 that used the Unix operating system.
 C is often called a middle-level computer language.
 This‫‏‬doesn‟t‫‏‬mean‫‏‬that‫‏‬C‫‏‬is‫‏‬less‫‏‬powerful,‫‏‬harder‫‏‬to‫‏‬
use, or less developed than a high level language
such as BASIC.
 Nor does it mean that C has the cumbersome nature
of assembly language (and its associated troubles).
 Rather, C combines the best elements of high-level
languages with the control & flexibility of assembly
language.
 C allows the manipulation of bits, bytes and addresses –
the basic elements with which the computer functions.
Despite this fact C code is also very portable.
 Unlike most high level languages, C specifies almost no run
– time error checking.
 For example no check is performed to ensure that array
boundaries are not overrun.
 These type of checks are the responsibility of the programmer.
 C is one of the most well suited languages for system – level
programming.
 A C program whatever its size, consists of functions &
variables.
 A function contains statements that specify the computing
operations to be done.
 Variables store values used during the computation.
 You are at liberty to give functions whatever names you like,
but main is special – your program begins executing at the
beginning of main.
 This means that every program should have a main
somewhere.
 main will usually call other functions to help perform its
job, some that you wrote & others that were provided for
you through libraries.
VARIABLE NAMES
 Names are made up of letters & digits.
 First character must be a letter.
 Underscore (“_”) counts as a letter.
 Uppercase & lowercase letters are distinct.
 Use lowercase for variable names & all uppercase for
symbolic constants.
 Keywords (if, else if, while etc.) cannot be used for
variable names.
 Keywords have to be in lowercase.
 Variable names shouldn‟t be the same as function names
in C library.
DATA-TYPES & SIZES
 Char – a single byte, used to store one character.
 Int – an integer, typically reflecting the natural size ( 2 or 4
bytes) of integers on the host machine.
 Float – single precision floating point (4 bytes).
 Double – double-precision floating point (8 bytes).
 Short int – always 2 bytes.
 Long int – always 4 bytes.
DATA-TYPES & SIZES
 The qualifier signed or unsigned can be used for char or
any integer.
 Unsigned numbers are always +ve or zero & obey the
laws of arithmetic modulo 2n.
 Signed numbers have the range -2n-1 to (+2n-1 – 1).

 The type long double specifies extended precision


floating point.
CONSTANTS
 A leading 0 (zero) on an integer constant means octal, a
leading 0x or 0X means hexadecimal.

 A character constant is an integer written as one character


within single quotes (eg: „x‟).
 The value of a character constant is the numeric value of
the character in the machine‟s character set. Eg: In ASCII
character set, „0‟ has the value 0x30.

 A string constant or string literal is a sequence of zero or


more characters surrounded by double quotes.
Eg: “I am a string”

 The internal representation of a string has a null character


(„\0‟) at the end, so the physical storage required is one more
than the number of characters written between the quotes.
DECLARATIONS
 A declaration specifies a type & contains a list of one or
more variables of that type.
Eg: int a, b, array[100];

 A variable may also be initialized in its declaration.


Eg: int i = 0; char var =‫„‏‬a‟;‫‏‬float‫‏‬eps = 1.0e-5.

 If the variable in question is not local, the initialization is


done only once, before the program starts executing.
 The initializer must be a constant expression.
DECLARATIONS

 External & static variables are initialized to zero by


default.
 Automatic variables (locals) for which there is no
explicit initializer have undefined values.
 The qualifier ‘const’ can be applied to the
declaration of any variable to specify that its value
will not be changed.
 The result is implementation defined if an attempt
is made to change a „const‟.
ARITHMETIC OPERATORS
 The binary arithmetic operators are: +, -, *, / and the
modulus operator %.
 Integer division truncates any fractional part.

 The expression x % y produces the remainder when x is


divided by y.
 The % operator cannot be applied to float or double.

 The direction of truncation for / and the sign of the result


for % are machine dependent for negative operands, as
is the action taken on overflow & underflow.
RELATIONAL & LOGICAL OPERATORS
 The relational operators are: >, >=, <, <=, ==, and !=.
 Relational operators have lower precedence than
arithmetic operators so an expression like I < lim -1 is taken
as I < (lim – 1).
 The logical operators are: && (logical and) and || (logical
or).
 Expressions connected by && or || are evaluated left to
right, and evaluation stops as soon as the falsehood or
truth of the result is known respectively.
 By definition the numeric value of a relational or logical
expression is 1 if the relation is true & 0 if the relation is
false.
 The unary negation operator (!) converts a non zero
operand into 0 & a zero operand into 1. A common use
of ! is in constructions like:
if (!valid)
rather than
if (valid ==0)
STATEMENTS & BLOCKS
 An expression such as x = 0 or i++ or printf(…) becomes
a statement when it is followed by a semicolon as in
x = 0; i++; printf(…);

 In C semicolon is a statement terminator.


 Braces { and } are used to group declarations &
statements together into a compound statement or
block, so that they are syntactically equivalent to a single
statement.
 There is no semicolon after the right brace that ends a
block.
CONTROL FLOW (IF-ELSE STATEMENT)‫‏‬
 The control flow statements of a language specify the
order in which computations are performed.
 If – else: The syntax is
if
(expression)
statement
1;
else
statement2;
 The else part above is optional
 The expression is evaluated; if it is true (i.e., if
expression has a non zero value), statement 1 is
executed. If it is false (expression is zero) & if there is
an else part as above then statement2 is executed
instead.
CONTROL FLOW (IF-ELSE STATEMENT)‫‏‬
 Since‫‏‬an‫“‏‬if”‫‏‬simply‫‏‬tests‫‏‬the‫‏‬numeric‫‏‬value‫‏‬of‫‏‬an‫‏‬
expression, certain coding shortcuts are
possible:
if(expression)
Instead
of
if(expression != 0)‫‏‬
Or
if(!expression)
Instead
of
if(expression == 0)‫‏‬
 Same is the case with other conditional statements &
loops which we shall see later.
CONTROL FLOW (IF-ELSE STATEMENT)‫‏‬
 Since the else part of an if-else is optional, there
is an ambiguity when an else is omitted from a
nested if sequence.
 This is resolved by associating the else with the closest
previous‫“‏‬else-less‫‏‬if”.
Eg: if (n > 0)‫‏‬
if(a > b)‫‏‬
z = a;
else
z = b;
Here the else goes with inner if as we have shown by indentation.
CONTROL FLOW (IF ELSE-IF)‫‏‬
 The‫‏‬construction‫‏‬of‫‏‬an‫“‏‬if‫‏‬else‫‏‬if”‫‏‬ladder‫‏‬is‫‏‬as‫‏‬shown:
if(expression)‫‏‬
statement
else if(expression)‫‏‬
statement
else if(expression)‫‏‬
statement
else
statement
CONTROL FLOW (IF ELSE-IF)‫‏‬
 The above sequence of if statements is the most general
way of writing a multi-way decision.
 Please note, the expressions are evaluated in order; if
any expression is true, the statement associated with it is
executed & this terminates the whole chain.
 As always, the code for each statement is either a single
statement or a group in braces.
 The last else part is optional & handles the “none of the
above” or default case where none of the other
conditions is satisfied.
CONTROL FLOW (SWITCH)‫‏‬
 The switch statement is a multi-way decision that tests
whether an expression matches one of a number of
constant integer values & branches accordingly.
 The construct is as follows:
switch (expression) {
case const expr: statements
case const expr: statements
default: statements
}
 Each case is labelled by one or more integer valued
constants or constant expressions.
 If a case matches the expression value, execution
starts at that case.
 All case expressions must be different.
 The case labelled default is optional & is executed if
none of the other cases are satisfied.
 Cases & the default clauses can occur in any order.
CONTROL FLOW (SWITCH STATEMENT)‫‏‬
 Kindly note, cases serve just as labels, after the code for
one case is done, execution falls through to the next
unless you take explicit action to escape.
 break & return are the most common ways to leave a
switch after the statements in a particular case are
executed & no fall through is required.
 Falling through cases is a mixed blessing, it allows several
cases to be attached to a single action.
CONTROL FLOW (WHILE LOOP)‫‏‬
 The while construct is:
while (expression)‫‏‬
statement
 The expression is evaluated, if it is non-zero,
statement is executed & expression is re-evaluated.
 This cycle continues until expression becomes zero,
at which point execution resumes after statement.
CONTROL FLOW (FOR LOOP)‫‏‬
 The for construct is:
for (expr1; expr2; expr3)‫‏‬
statement
 Most commonly, expr1 & expr3 are assignments or
function calls & expr2 is a relational expression.
 Any of the 3 parts can be omitted, although the semi-
colons must remain.
 If expr1 or expr3 is omitted, it is simply dropped from the
expansion. However, if the test, expr2, is not present, it is
taken as permanently true.
 Thus the loop:
for ( ; ; ) {

}
is an “infinite” loop, presumably to be broken by other
means such as a break or return.
CONTROL FLOW (FOR LOOP)‫‏‬
 Whether to use while or for is largely a matter of personal
preference.
 As a matter of practice, the while is most natural when
there is no initialization or re-initialization as in:
while (a = getchar() && b == c)‫‏‬
;
– The for is preferable when there is a simple initialization &
increment, since it keeps the loop control statements
close together & visible at the top of the loop as in:
for(I = 0; I < n; I++)‫‏‬

 Please note that the components of for are arbitrary
expressions, for loops are not restricted to arithmetic
progressions.

 Nonetheless, it is bad style to force unrelated computations


into the initialization & increment of a for, which are better
reserved for loop control operations.
CONTROL FLOW (FOR LOOP)‫‏‬
 One C operator is the comma “,” which most often finds use in
the for statement.
 A pair of expressions separated by a comma is evaluated
left to right, & the type & value of the result are the type &
value of the right operand.
 Thus in a for statement, it is possible to place multiple
expressions in the various parts, for example to process 2
indices in parallel:
for (I = 0, j = 1; I < j; I++, j--)‫‏‬

 The commas that separate function arguments, variables in
declarations etc., are not comma operators & do not guarantee
left to right evaluation.
CONTROL FLOW (DO-WHILE LOOP)‫‏‬
 The do-while syntax is:
do
statement
While (expression);
• The statement is executed, then expression is evaluated.
• If it is true, statement is evaluated again & so on. When
the expression becomes false, the loop terminates.
• Hence we see the statement is executed at least once
irrespective of the expression being either true or false.
 Experience shows that do-while is much less used
than while & for.
CONTROL FLOW (BREAK & CONTINUE)‫‏‬
 It is sometimes convenient to be able to exit from
a loop other than by testing at the top or bottom.
 Thus the break statement provides an early exit
from for, while & do, just as from switch.
 A break causes the innermost enclosing loop or switch to be exited
immediately.
 The continue statement is related to break, but
less often used; it causes the next iteration of the
enclosing for, while or do loop to begin.
 In the while & do, this means that the test part is executed
immediately
 In the for, control passes to the increment step.
 The continue statement applies only to loops, not
to switch.
 A continue inside a switch inside a loop causes the next loop
iteration.
FUNCTIONS & PROGRAM STRUCTURE
 Functions break large computing tasks into smaller ones &
enable people to build on what others have done instead
of starting over from scratch.
 C has been designed to make functions efficient & easy to
use; C programs generally consist of many small functions
rather than a few big ones.
 A program may reside in one or more source files, source
files may be compiled separately & loaded together along
with previously compiled functions from libraries.
 A minimal function is
dummy () { }
which does nothing & returns nothing.
 Communication between the functions is by arguments &
values returned by the functions & through external
variables.
FUNCTIONS & PROGRAM STRUCTURE
 The Functions can occur in any order in the source file & the
source program can be split into multiple files, so long as no
function is split.
 The return statement is the mechanism for returning a value
from the called function to the caller. Any expression can
follow return:
return expression;
 The expression will be converted to the return type of the function
if necessary.
 Parentheses are often used around the expression but they are
optional.
 The calling function is free to ignore the returned value.
 Furthermore, there need be no expression after return; in that
case no value is returned to the caller.
 Control also returns to the caller with no value when CPU
reaches the closing right brace of the function.
 In‫‏‬any‫‏‬case,‫‏‬if‫‏‬a‫‏‬function‫‏‬fails‫‏‬to‫‏‬return‫‏‬a‫‏‬value,‫‏‬its‫“‏‬value”‫‏‬is‫‏‬
certain to be garbage.
FUNCTIONS & PROGRAM STRUCTURE
 Block Structure:
 Variables can be defined in a block-structured fashion within a
function.
 Declarations of variables (including initializations) may follow the left
brace that introduces the compound statement, not just the one that
begins a function.
 Variables declared in this way hide any identically named variables in
outer blocks & remain in existence until the matching right brace.
Eg: int I;
if(n > 0) {
int I;
for(I = 0; I < n; I++)‫‏‬

}
 A local variable declared & initialized in a block is initialized each
time the block is entered.
 A static variable is initialized only the first time the block is entered.
 Local variables, including formal parameters, also hide external
variables & functions of the same name.
FUNCTIONS & PROGRAM STRUCTURE
 Block Structure:
 As a matter of style, its best to avoid variable names that conceal
names in an outer scope; the potential for confusion & error is great.
 Initialization:
 In the absence of explicit initialization, external & static
variables are guaranteed to be initialized to zero.
 Local & register variables have undefined (garbage) initial
values if not explicitly initialized.
 Scalar variables may be initialized when they are defined, by
following the name with an equals sign & an expression:
eg: int x = 1;
char squote =‫;‟‟\„‏‬
long day = 1000L * 60L * 60L * 24L;
FUNCTIONS & PROGRAM STRUCTURE
 Initialization:
 For external & static variables, the initializer must be a
constant expression.
• The initialization is done once, conceptually before the program
begins execution.
 For local & register variables, the initialization is done
each time the function or block is entered.
• The initializer in this case is not restricted to being a constant, it
may be any expression involving previously defined values,
even function calls.
 An array may be initialized by following its declaration
with a list of initializers enclosed in braces separated by
commas.
Eg: int days[ ] = {31, 28, 31, 30, 31};
• When the size of the array is omitted, the compiler will compute
the length by counting the initializers.
FUNCTIONS & PROGRAM STRUCTURE
 Initialization:
 If there are fewer initializers for an array than the number
specified, the missing elements will be zero for external,
static & automatic variables.
 It is an error to have too many initializers.
 There is no way to specify repetition of an initializer, nor to
initialize an element in the middle of an array without
supplying the preceding values as well.
 Character arrays are a special case of initialization.
• A string may be used instead of the braces & commas notation.
Eg: char‫‏‬pattern[‫“‏=‏]‏‬hello”;
Is a shorthand for the longer but equivalent
char‫‏‬pattern[‫„‏{‏=‏]‏‬h‟,‫„‏‬e‟,‫„‏‬l‟,‫„‏‬l‟,‫„‏‬o‟,‫\„‏‬0‟‫;}‏‬
• In this case the array size is 6, 5 characters plus the terminating
„\0‟
THE C PREPROCESSOR
 C provides certain language facilities by means of a
preprocessor, which is conceptually a separate first
step in compilation.
 The two most frequently used features are #include, to
include the contents of a file during compilation &
#define, to replace a token by an arbitrary sequence of
characters.
• Any source line of the form
#include <filename>
is replaced by the contents of the file filename.
• Any include file itself may contain #include lines.
• A definition is of the form
#define name replacement text
The above calls for the subsequent occurrences of the token
name to be replaced by the replacement text.
POINTERS
 A Pointer is a variable that contains the address of a
variable.
Pointer variable
address value

 Pointers are much used in C, partly because they are


sometimes the only way to express a computation & partly
because they lead to more compact & efficient code.
 Pointers & Addresses:
 How memory is organized ?
• A typical machine has an array of consecutively numbered or
addressed memory cells that may be manipulated individually
or in contiguous groups.
• Any byte can be a char, a pair of one byte cells can be treated
as a short integer & 4 adjacent bytes form a long.
• A pointer is a group of cells (2 or 4) that can hold an address.
POINTERS
 Pointers & Addresses:
 The‫‏‬unary‫‏‬operator‫‏”&“‏‬gives‫‏‬the‫‏‬address‫‏‬of‫‏‬an‫‏‬object,‫‏‬so‫‏‬
the statement
p = &c;
assigns the address of c to the variable p and p is said to
“point‫‏‬to”‫‏‬c.
• The & operator only applies to objects in memory:
variables & array elements.
• It cannot be applied to expressions, constants or
register variables.
 The‫‏‬unary‫‏‬operator‫‏”*“‏‬is‫‏‬the‫‏‬indirection‫‏‬or‫‏‬dereferencing‫‏‬
operator.
• When applied to a pointer it accesses the object the
pointer points to.
Eg: int *p, x = 1;
p = &x;
Here p is said to be a integer pointer, in the second
statement it is made to point to the variable x. Thus *p
will give 1 as the result since x is initialized to 1.
POINTERS
 Pointers & Addresses:
 Also note that a pointer is constrained to point to a
particular kind of object: every pointer points to a
specific data type.
• Consider:
Int *p, x[10]; p = x; ++p;
Here we can see p is a pointer to an integer & it is made to
point to an array of integers x. The third statement increments
the pointer by 2 bytes (assuming natural size of integer on the
host as 2 bytes).
• Thus the address arithmetic of the pointer is related
to the data type that it points to.
 Address Arithmetic:
 A pointer can be initialized to value of an expression
involving the address of previously defined data of
appropriate type or to a value zero.
• C guarantees that zero is never a valid address for data, so
the value zero may be used to signal an abnormal event.
POINTERS
 Address Arithmetic:
 Pointers and integers are not inter-changeable.
• Zero is the sole exception: the constant zero may be
assigned to a pointer & a pointer may be compared with
the constant zero.
 Pointers may be compared under certain circumstances.
• If p and q point to members of the same array, then
relations like ==, !=, <, >=, etc., work properly.
• Any pointer may be meaningfully compared for equality
or inequality with zero.
• The behavior I undefined for arithmetic or comparisons
with pointers that do not point to members of the same
array.
 A pointer and an integer may be added or subtracted. The
construction:
p+n
means the address of the n-th object beyond the one p
currently points to. Here n is scaled according to the size
of the objects p points to, which is determined by th
declaration of p
POINTERS
 Address Arithmetic:
 Pointer subtraction is also valid: if p and q point to
elements of same array and p < q, then q–p+1 is
the number of elements from p to q inclusive.
 Pointer arithmetic is consistent: if p were a pointer
to an array of floats, p++ would advance to the
next float.
• All the pointer manipulations automatically take into
account the size of the object pointed to.
 It is not legal to:
• Add 2 pointers.
• Multiply or divide or shift or mask them.
• To add float or double to them.
• To assign a pointer of one type to a pointer of another
type without a cast (except for void * which is a generic
pointer).
KEIL IDE FOR 8051 FAMILY
CONTROLLERS
 The8051 Family is one of the fastest
growing Microcontroller Architectures.
 More than 500 device variants available.

 Keilprovides several development


tools for these 8051 variants.
 C51 Compiler
 A51 Macro Assembler
 BL51 Linker/Locater

SRG-2009
SOFTWARE DEVELOPMENT CYCLE IN KEIL
1) Create a project, select the target chip from the device
database, and configure the tool settings.

2) Create source files in C.

3) Build your application with the project manager.

4) Correct errors in source files.

5) Test the linked application.


CREATE A PROJECT FILE

 To create a new project file select from the µVision menu


Project – New Project…. This opens a standard
Windows dialog that asks you for the new project file
name.

 We suggest that you use a separate folder for each


project.
SELECT A DEVICE

 When you create a new project µVision asks you to


select a CPU for your project. The Select Device dialog
box shows the µVision device database. Just select the
microcontroller you use.
CREATE NEW SOURCE FILES
 You may create a new source file with the menu option File –
New. This opens an empty editor window where you can enter
your source code. µVision enables the C color syntax
highlighting when you save your file with the dialog File –
Save As… under a filename with the extension *.C.

SRG-2009
ADD SOURCE FILE TO THE PROJECT
 Once you have created your source file you can add this file to
your project.
 For example, you can select the file group in the Project
Workspace – Files page and click with the right mouse key to
open a local menu. The option Add Files opens the standard
files dialog. Select the file MAIN.C you have just created.

SRG-2009
SET TOOL OPTIONS FOR TARGET
 µVision lets you set options for your target hardware. The
dialog Options for Target opens via the toolbar icon or
via the Project - Options for Target menu item. In the
Target tab you specify all relevant parameters of your
target hardware and the on-chip components of the
device you have selected.

SRG-2009
SET TOOL OPTIONS FOR TARGET
 The following table describes the options of the Target
dialog:
BUILD PROJECT AND CREATE A HEX FILE
 You may translate all source files and line the application with a
click on the Build Target toolbar icon. When you build an
application with syntax errors, µVision will display errors and
warning messages in the Output Window – Build page.
 A double click on a message line opens the source file on the
correct location in a µVision editor window.
BUILD PROJECT AND CREATE A HEX FILE
 Once you have successfully generated your application you can start
debugging using the µVision Debugger.
 After you have tested your application, it might be required to create an
Intel HEX file and to download the application software into the physical
device using a Flash programming utility.
 µVision creates HEX files with each build process when Create HEX file
under Options for Target – Output is enabled.

SRG-2009
OUTPUT FILES
 The Cx51 Compiler generates a number of output files
during compilation.

 By default, each output file shares the same filename as


the source file.
 each has a different file extension.
Files with this extension are listing files that contain the
.LST formatted source text along with any errors detected by
the compiler. Listing files may optionally contain the
symbols used and the assembly code generated.
Files with this extension are object modules that contain
.OBJ relocatable object code. Object modules may be linked to
an absolute object module by the Lx51 Linker/Locator.

Files with this extension contain the source text as


.I expanded by the preprocessor. All macros are expanded
and all comments are deleted in this listing.

Files with this extension are assembly source files


.SRC generated from your C source code. These files can be
assembled with the A51 Assembler.

Image of the machine code generated, to be burnt onto


.Hex the target device.

You might also like