Embedded Firmware Development
Languages
Kavita S Bagewadi
1st Semister
VLSI And ES
There are 3 type of Languages:
1. Assembly Language
2. High Level Languages
3. Mixed Level Languages
1. 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 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 assembler.
• The general format of an assembly language instruction is an
Opcode followed by Operand.
• The Opcode tells the processor/controller what to do
• Operands provide the data and information required to
perform the action specified by the opcode.
• Assembly language instructions are written one per line.
• A machine code program consists of assembly language
instructions, where each statement contains a
mnemonic(opcode + operand)
Ex: Mov A , #30
• Each line of an assembly language program is split into four
fields as:
LABEL OPCODE OPERAND COMMENTS
•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.
• The software utility called ‘Assembler’ performs the
translation of assembly code to machine code.
• 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
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 of assembly level language:
• Efficient code memory and Data memory usage
• High Performance
• Low level hardware access
• Code reverse engineering
Drawbacks:
• High Development time
• Developer Dependency
• Non-Portable
2. High Level Language:
• The embedded firmware is written in only high level
languages 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 ‘Object to Hex file converter’
translates the absolute object file to corresponding hex
file(binary file)
• Compiler:
Translates program for same hardware/platform/machine
on it is running.
• Cross-Compiler:
Translates program for different hardware/
platform/machine other than the platform which it is running.
Advantages :
• Reduced Development time
• Developer Independency
• Portability
Limitations :
• Some cross-compilers available for high level languages may
not be so efficient in generating optimized target processor
specific instructions.
• Such compilers may be messy and non-optimized in terms of
performance as well as code size.
3. Mixing Assembly and High level language:
High level language and assembly languages are usually
mixed in three ways; namely,
• Mixing assembly language with high level language
• Mixing high level language with assembly
• In-line Assembly programming
I. Mixing Assembly with High level language:
(ex: Assembly language with ‘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 a built in support for implementing
certain features like Interrupt Service Routine functions
(ISR).
II. Mixing High level language with Assembly
language :
Mixing the code written in a high level language like ‘C’ and
assembly language is useful in the following scenarios:
1. The source code is already available in Assembly language
and a routine written in a high level language like ‘C’ needs
to be included to the existing code.
2. 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.
3. To include built in library functions written in ‘C’ language
provided by the cross compiler. For example Built in Graphics
library functions and String operations supported by ‘C’.
III. Inline Assembly:
Inline assembly is another technique for
inserting target processor/controller specific assembly
instructions at any location of a source code written in
high level language ‘C’.
This avoids the delay in calling an assembly
routine front a ‘C’ code.
Thank You