100% found this document useful (2 votes)
250 views

Unit 3: Embedded Firmware & Hardware Design and Development

This document discusses firmware design and development for embedded systems. It describes two approaches: the super loop based approach and the embedded operating system based approach. The super loop based approach involves executing tasks sequentially in a infinite loop. It is suitable for non-time critical applications. The embedded operating system based approach uses an operating system like a real-time OS to schedule tasks, allowing for more flexible task execution and better real-time performance. Common languages used for embedded firmware development include assembly language, C, and other high-level languages supported by cross-compilers.

Uploaded by

Aakarsh Kumar
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
100% found this document useful (2 votes)
250 views

Unit 3: Embedded Firmware & Hardware Design and Development

This document discusses firmware design and development for embedded systems. It describes two approaches: the super loop based approach and the embedded operating system based approach. The super loop based approach involves executing tasks sequentially in a infinite loop. It is suitable for non-time critical applications. The embedded operating system based approach uses an operating system like a real-time OS to schedule tasks, allowing for more flexible task execution and better real-time performance. Common languages used for embedded firmware development include assembly language, C, and other high-level languages supported by cross-compilers.

Uploaded by

Aakarsh Kumar
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/ 22

Unit 3

Embedded Firmware & Hardware


Design and Development:
Firmware Design and Development
Introduction
• Embedded firmware is responsible for controlling various peripherals of the embedded
hardware and generating responses in accordance with the functional requirements mentioned
in the requirements for the product.
• Firmware is considered as the master brain of the embedded systems.
• Once the intelligence is imparted to the embedded product, by embedding the firmware in the
hardware, the product start functioning properly and will continue serving the assigned task
till hardware breakdown occurs.
• Designing an embedded firmware requires understanding of 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.
• Embedded firmware development process start with conversion of firmware requirements
into a program model using modeling tools like UML or flow chart-based representation.
• Once the program modeling is created, next step is the implementation of the task and actions
by capturing the model using a language which is understandable by the target processor.
EMBEDDED FIRMWARE DESIGN APPROACHES:

• Firmware design approaches depends on the

– Complexity of the function to be performed.


– Speed of operation required.
• Two basic approaches for firmware design.
– Conventional Procedure based Firmware Design/Super Loop Design.
– Embedded Operating System Based Design.
SUPER LOOP BASED APPROACH
▪ This approach is applied for the applications that are not time critical and the response time is
not so important.
▪ Like the conventional procedural programming where the code is executed task by task.
▪ Task listed at the top of the program code is executed first and task below the first task are
executed after completing the first task.
▪ True procedural one.
▪ In multiple task-based systems, each task executed in serial.
▪ Firmware execution flow of this will be:
1. Configure the common parameter 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. Execute the last defined task
7. Jump back to the first task and follow the same flow
SUPER LOOP BASED APPROACH
▪ From the firmware execution sequence, it is obvious that the order in which the task to be
executed are fixed and they are hard coded in the code itself
▪ Operations are infinite loop-based approach
▪ In terms of C program code as:
Void main()
{ configuration(); initializations(); while(1)
{
task1();
task2();
…..
taskn ();
}
}
SUPER LOOP BASED APPROACH
▪ Almost all task in embedded applications are non-ending and are repeated infinitely
throughout the operation.
▪ By analyzing C code, we can see that the task 1 to n are performed one after another and
when the last task is executed, the firmware execution is again redirected to task 1 and it is
repeated forever in the loop.
▪ This repetition is achieved by using an infinite loop (while(1)).
▪ Therefore, Super loop-based Approach, since the task are running inside an infinite loop, the
only way to come out of the loop is either
▪ Hardware reset or Interrupt assertion
▪ A Hardware reset brings the program execution back to the main loop.
▪ Whereas the interrupt suspend the task execution temporarily and perform the corresponding
interrupt routine and on completion of the interrupt routine it restart the task execution from
the point where it got interrupted.
▪ Super Loop based design does not require an OS, since there is no need for scheduling which
task is to be executed and assigning priority to each task.
SUPER LOOP BASED APPROACH
▪ In a super Loop based design, the priorities are fixed and the order in which the task to be
executed are also fixed.
▪ Hence the code for performing these task will be residing in the code memory without an
operating system.
▪ This type of design is deployed in low-cost embedded products where the response time is
not time critical.
▪ Some embedded products demand this type of approach if some tasks itself are sequential.
▪ Example of Super Loop Based Design is Electronic video game toy containing keypad and
display unit
▪ The program running inside the product must be designed in such a way that it reads the key
to detect whether user has given any input and if any key press is detected the graphic display
is updated.
▪ The keyboard scanning and display updating happens at a reasonable high rate
▪ Even if the application misses the key press, it won‘t create any critical issue.
▪ Rather it will treated as a bug in the firmware.
Drawback of SUPER LOOP BASED APPROACH
▪ Major drawback of this approach is that any failure in any part of a single task will affect the
total system
▪ If the program hang up at any point while executing a task, it will remain there forever and
ultimately the product will stop functioning
▪ Some remedial measures are there
▪ 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 hang up
▪ May cause additional hardware cost and firmware overhead
▪ Another major drawback is 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.
▪ To identify the key press, you may have to press the key for a sufficiently long time till the
keypad status monitoring task is executed internally.
▪ Lead to lack of real timeliness.
EMBEDDED OPERATING SYSTEM BASED APPROACH
▪ Contains OS, which can be either a General-purpose Operating System (GPOS) or real Time
Operating System (RTOS).
▪ GPOS based design is very similar to the conventional PC based Application development
where the device contain an operating system and you will be creating and running user
applications on top of it
▪ Examples of Microsoft Windows XP OS are PDAs, Handheld devices/ Portable Devices and
point of Sale terminals.
▪ RTOS based design approach is employed in embedded product demanding Real Time
Responses.
▪ RTOS respond in a timely and predictable manner to events.
▪ RTOS contain a real time Kernel responsible for performing pre- emptive multi tasking
scheduler for scheduling the task, multiple thread etc.
▪ RTOS allows a flexible scheduling of system resources like the CPU and Memory and offer
some way to communicate between tasks
▪ Examples of RTOS are
▪ Windows CE, pSOS, VxWorks, ThreadX, Micro C/OS II, Embedded Linux, Symbian etc…
Embedded Firmware Development Languages
▪ For embedded firmware development you can use either
▪ Target processor/controller specific language (Assembly language) or
▪ Target processor/ controller independent language (High level languages) or
▪ Combination of Assembly and high-level language
▪ Assembly language-based development
▪ Assembly language is human readable notation of machine language whereas machine
language is a processor understandable language.
▪ Machine language is a binary representation and it consist of 1s and 0s.
▪ Machine language is made readable by using specific symbols called mnemonics.
▪ Hence machine language can be considered as an interface between processor and programmer.
▪ Assembly language and machine languages are processor dependent and assembly program
written for one processor family will not work with others.
▪ Assembly language programming is the task of writing processor specific machine code in
mnemonics form, converting the mnemonics into actual processor instructions (machine
language) and associated data using an assembler.
▪ Each line of assembly language program split into four field as given below
▪ LABEL OPCODE OPERAND COMMENTS
Assembly language-based development

▪ Opcode tells what to do and Operand gives the information to do the task
▪ The operand may be single operand, dual operand or more
▪ MOV A, #30
▪ Here MOV A is the opcode and 30 is Operand
▪ Same instruction in machine language like this 01110100 00011110
High Level Language Based Development
▪ Any High-level language with a supported cross compilers for the target processor can be
used for embedded firmware development
▪ Cross Compilers are used for converting the application development in high level language
into target processor specific assembly code
▪ Most used language is C
▪ C is well defined easy to use high level language with extensive cross platform development
tool support
▪ The program written in any of the high-level language is saved with the corresponding
language extension
▪ Any text editor provided by IDE tool supporting the high-level language in use can be used
for writing the program For more visit www.ktunotes.in
▪ Most of the high-level language support modular programming approach and hence you can
have multiple source files called modules written in corresponding high-level language
Embedded C
▪ It is a ‘mid-level’, with ‘high-level’ features (such as support for functions and modules), and
‘low-level’ features (such as good access to hardware via pointers)
▪ C is the most common Embedded language, 85% of embedded applications are coded in C.
▪ C , when used correctly is as safe and robust as any other high-level language.
▪ It directly manipulates the hardware and memory addresses.
▪ It is very efficient; It is popular and well understood
▪ Good, well proven compilers are available for every embedded processor(8-bit to 32-bit or
more)
▪ Cx51 Cross compiler supports all the ANSI Standard C directives.

You might also like