Embedded Firmware
Embedded Firmware
Embedded firmware refers to the control algorithm (Program instructions) and or the
configuration settings that an embedded system developer dumps into the code (Program) memory
of the embedded system. It is an un-avoidable part of an embedded system. There are various
methods available for developing the embedded firmware. They are listed below.
(a) Write the program in high level languages like Embedded C/C++ using an Integrated
Development Environment (The IDE will contain an editor, compiler, linker, debugger, simulator,
etc. IDEs are different for different family of processors/controllers. For example, Keil micro
vision3 IDE is used for all family members of 8051 microcontroller, since it contains the generic
8051 compiler C51).
(b) Write the program in Assembly language using the instructions supported by your application’s
target processor/controller.
The instruction set for each family of processor/controller is different and the program written in
either of the methods given above should be converted into a processor understandable machine
code before loading it into the program memory.
The methods used for HEX File Creation may differ depending on the programming
techniques used.
Third-party tools are also available, which may be free of cost, for this conversion.
1. Reset Circuit:
The reset circuit is necessary to ensure that electronic devices do not operate at a
voltage level where they may not function correctly during system power ON.
The reset signal puts the internal registers and different hardware systems of the
processor/controller in a known state and starts firmware execution from the reset
vector.
The reset vector is typically located at vector address 0x0000 for conventional
processors/controllers, but it can be relocated to a different address for
processors/controllers supporting a bootloader.
The reset signal can be either active high or active low, depending on the processor's
requirements.
The processor operates synchronously with a clock signal, so the reset pulse must be
wide enough to allow the clock oscillator to stabilize before the internal reset state
begins.
The reset signal can be applied at power ON through an external passive reset circuit
composed of a capacitor and resistor or through a standard Reset IC like MAX810
from Maxim Dallas.
The selection of the reset IC should be based on the type of reset signal and logic
level (CMOS/TTL) supported by the processor/controller in use.
Some microprocessors/controllers have built-in internal reset circuitry and do not
require external reset circuitry.
Figure 1 shows a resistor capacitor-based passive reset circuit for active high and low
configurations.
The reset pulse width can be adjusted by changing the resistance value R and
capacitance value C of the circuit.
2. Brown-out Protection Circuit:
3. Oscillator Unit:
Figure 3: Oscillator circuitry using quartz crystal and quartz crystal oscillator
5. Watchdog timer:
Figure 4: Watchdog timer for fi rmware execution supervision
In desktop Windows systems, 'Ctrl + Alt + Del' can be used to come out of an
abnormal situation, but this is not available in embedded systems.
Embedded systems have a watchdog timer to monitor the firmware execution and
reset the system processor/microcontroller if the program execution hangs up.
The watchdog timer is a hardware timer that increments or decrements a free-
running counter with each clock pulse and generates a reset signal to reset the
processor if the count reaches zero for a down-counting watchdog, or the highest
count value for an up-counting watchdog.
The firmware can write a zero to the watchdog timer register before starting the
execution of a piece of code that is susceptible to execution hang up, and the
watchdog will start counting. If the firmware execution doesn't complete within the
time required by the watchdog to reach the maximum count, the counter will
generate a reset pulse and reset the processor.
Most processors have a built-in watchdog timer and provide a status register to
control the watchdog timer and a watchdog timer register for writing the count
value. If the processor doesn't contain a built-in watchdog timer, an external
watchdog timer IC circuit can be used.
The Microprocessor supervisor IC DS1232 integrates a hardware watchdog timer in
it.
In modern systems running on embedded operating systems, the watchdog can be
implemented in such a way that when a watchdog timeout occurs, an interrupt is
generated instead of resetting the processor.
The interrupt handler for the watchdog timeout situation handles the situation in an
appropriate fashion.
Figure 4 illustrates the implementation of an external watchdog timer based
microprocessor supervisor circuit for a small scale embedded system.