You are on page 1of 29

SUBJECT : EMBEDDED REAL-TIME OPERATING

SYSTEMS
UNIT – II

EMBEDDED FIRMWARE DESIGN

KRISHNA PRASAD SATAMRAJU


ASSOCIATE PROFESSOR
DEPARTMENT OF CSO
EMBEDDED FIRMWARE

• In computing, firmware is a specific class of computer


software that provides the low-level control for a device's
specific hardware.
• The embedded firmware is responsible for controlling the
various peripherals of the embedded hardware and
generating response in accordance with the functional
requirements mentioned in the requirements for the
particular embedded product.

• Firmware is considered as the master brain of the


embedded system.
EMBEDDED FIRMWARE

• Imparting intelligence to an Embedded system is a one time process and it


can happen at any stage, it can be immediately after the fabrication of the
embedded hardware or at a later stage.
• Once intelligence is imparted to the embedded product, by embedding the
firmware in the hardware, the product starts functioning properly and will
continue serving the assigned task till hardware breakdown occurs or a
corruption in embedded firmware occurs.
• In case of hardware breakdown, the damaged component may need to be
replaced by a new component and for firmware corruptions the firmware
should be re-loaded, to bring back the embedded product to the normal
functioning.
• For most of the embedded products the embedded firmware is stored at a
permanent memory (ROM) and they are nonalterable by end users.
EMBEDDED SYSTEM FIRMWARE DESIGN

• Two basic approaches are used for Embedded firmware


design. They are
• Conventional Procedural Based Firmware Design
(Super loop Model)
• Embedded Operating System (OS) Based Design
INTURRUPTS
• Interrupt is an event that stops the current execution of a process
(task) in the CPU and transfers the program execution to an address
in code memory where the service routine for the event is located.
• ISR is coded in such a way that it takes care of the following:
• Save the current context (Important Registers which the ISR will modify)
• Service the Interrupt
• Retrieve the saved context (Retrieve the original contents of registers)
• Return to the execution point where the execution is interrupted
INTURRUPTS

Example
DAISYCHAIN / SERIAL INTERRUPT HANDLING
PRIORITY INTERRUPT HANDLING
DIRECT MEMORY ACCESS (DMA)
• When transferring a block of data, instructions are needed to
increment the memory address and keep track of the word
count.
• The use of interrupts involves operating system routines which
incur additional overhead to save and restore processor
registers, the program counter, and other state information.
• An alternative approach is used to transfer blocks of data
directly between the main memory and I/O devices, such as
disks.
• A special control unit is provided to manage the transfer,
without continuous intervention by the processor. This
approach is called direct memory access, or DMA.
DMA CONTROLLER
• The unit that controls DMA transfers is referred to as a
DMA controller.
• It may be part of the I/O device interface, or it may be a
separate unit shared by a number of I/O devices.
• The DMA controller performs the functions that would
normally be carried out by the processor when
accessing the main memory.
• For each word transferred, it provides the memory
address and generates all the control signals needed.
• It increments the memory address for successive
words and keeps track of the number of transfers.
USE OF DMA CONTROLLER
REGISTERS USED IN DMA CONTROLLER
DMA OPERATION
• To start a DMA transfer of a block of data from the main memory
to one of the disks, an OS routine writes the address and word
count information into the registers of the disk controller.

• The DMA controller proceeds independently to implement the


specified operation. When the transfer is completed, this fact is
recorded in the status and control register of the DMA channel
by setting the Done bit.
• At the same time, if the IE bit is set, the controller sends an
interrupt request to the processor and sets the IRQ bit.

• The status register may also be used to record other information,


such as whether the transfer took place correctly or errors
occurred.
DMA OPERATION
• Burst Mode: In this mode DMA handover the buses to CPU only
after completion of whole data transfer. Meanwhile, if the CPU
requires the bus it has to stay ideal and wait for data transfer.

• Cycle Stealing Mode: In this mode, DMA gives control of buses to


CPU after transfer of every byte. It continuously issues a request
for bus control, makes the transfer of one byte and returns the
bus. By this CPU doesn’t have to wait for a long time if it needs a
bus for higher priority task.

• Transparent Mode: Here, DMA transfers data only when CPU is


executing the instruction which does not require the use of buses.
DEVICE DRIVERS
• Device driver is a piece of software that acts as a bridge between
the operating system and the hardware. In an operating system
based product architecture, the user applications talk to the
Operating System kernel for all necessary information exchange
including communication with the hardware peripherals.
DEVICE DRIVERS
A device driver implements the following:

1. Device (Hardware) Initialization and Interrupt configuration

2. Interrupt handling and processing

3. Client interfacing (Interfacing with user applications)


CONVENTIONAL PROCEDURAL BASED DESIGN
• ‘Super loop based design’ is simple and straight forward without any OS related
overheads. The major drawback of this approach is that any failure in any part of a
single task may affect the total system.
• If the program hangs up at some point while executing a task, it may remain there
forever and ultimately the product stops functioning. There are remedial measures
for overcoming this. Use of Hardware and software
• Watch Dog Timers (WDTs) helps in coming out from the loop when an unexpected
failure occurs or when the processor hangs up. This, in turn, may cause additional
hardware cost and firmware overheads.
• Another major drawback of the ‘Super loop’ design approach is the lack of real
timeliness. If the number of tasks to be executed within an application increases,
the time at which each task is repeated also increases.
• This brings the probability of missing out some events. For example in a system
with Keypads, according to the ‘Super loop design’, there will be a task for
monitoring the keypad connected I/O lines and this need not be the task running
while you press the keys
CONVENTIONAL PROCEDURAL BASED DESIGN
SERIAL VS. PARALLEL I/O
• Board I/O that can transmit and receive data in serial is made up of
components in which data (characters) are stored, transferred, and
received one bit at a time.
• Serial I/O hardware is typically made up of some combination of
the six main logical units outlined at the start of the chapter. Serial
communication includes within its I/O subsystem a serial port and a
serial interface
SERIAL TRANSMISSION SCHEMES

Simplex

Half-Duplex

Full -Duplex
ASYNCHRONOUS SERIAL TRANSMISSION
SERIAL PORTS

• Networking and Communications: RS-232, RS85


• SPI
• I2C
• UART
PARALLEL PORTS
• Parallel interfaces manage the parallel data transmission and reception
between the master CPU and either the I/O device or its controller.
• They are responsible for decoding data bits received over the pins of the
parallel port (transmitted from the I/O device) and receiving data being
transmitted from the master CPU, then encoding these data bits onto the
parallel port pins.
• Parallel I/O does have a greater capacity to transmit data than serial I/O,
because multiple bits can be transmitted or received simultaneously.
Examples of board I/O that transfer and receive data in parallel include
• IEEE 1284 controllers (for printer/display I/O device)
• CRT ports
• SCSI (Small Computer Systems Interface) (for storage I/O devices)
• A protocol that can potentially support both parallel and serial I/O is
Ethernet..
HDL BASED VLSI DESIGN PROCESS
ELECTRONIC DESIGN AUTOMATION TOOLS

• Electronic design automation (EDA), also referred to as electronic


computer-aided design (ECAD), is a category of software tools for
designing electronic systems such as integrated circuits and printed
circuit boards.
• The design of a PCBA using ECAD software is a sequential
process, consisting of the following steps:
• Schematic Generation (Capture)
• PCB Layout
• Simulation
• ECAD Integration 
END OF UNIT - II

You might also like