Unit 3 Embedded Firmware Development Languages
Unit 3 Embedded Firmware Development Languages
1
At the end of this session, you will be able to
• Discuss the different languages for embedded firmware development and the merits and
limitations of each
02/27/2025 2
Embedded Firmware Development Languages
• As mentioned in previous you can use either a target processor/controller specific language
(Generally known as Assembly language or low level language) or a target
processor/controller independent language (Like C, C++, JAVA, etc. commonly known as
High Level Language) or a combination of Assembly and High level Language
• Here discuss where each of the approach is used and the relative merits and de-merits of
each, in the following section
02/27/2025 3
Assembly Language based Development
• ‘Assembly language’ is the human readable notation of ‘ machine language’, whereas
‘machine language’ is a processor understandable language
• Processors deal only with binaries (1s and 0s).
• Machine language is a binary representation and it consists 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/controller dependent and an
assembly program written for one processor/controller family will not work with others
02/27/2025 4
Assembly Language based Development conti….
• The general format of an assembly language instruction is an Opcode followed by Operands
• The Opcode tells the processor/controller what to do and the Operands provide the data and
information required to perform the action specified by the opcode
• It is not necessary that all opcode should have Operands following them
• Some of the Opcode implicitly contains the operand and in such situation no operand is
required
• The operand may be a single operand, dual operand or more
02/27/2025 5
Assembly Language based Development conti….
• Analyze each of language with the 8051 ASM instructions as an example
• MOV A, #30
• This instruction mnemonic moves decimal value 30 to the 8051 Accumulator register. Here
MOV A is the Opcode and 30 is the operand (single operand)
• The same instruction when written in machine language will look like 01110100 00011110
• where the first 8 bit binary value 01110100 represents the opcode MOV A and the second 8
bit binary value 00011110 represents the operand 30
• The mnemonic INC A is an example for instruction holding operand implicitly in the Opcode.
The machine language representation of the same is 00000100. This instruction increments
the 8051 Accumulator register content by 1
02/27/2025 6
Assembly Language based Development conti….
• Assembly language instructions are written one per line
• A machine code program thus consists of a sequence of assembly language instructions,
where each statement contains a mnemonic ( Opcode + Operand)
• Each line of an assembly language program is split into four fields as given below
LABEL OPCODE OPERAND COMMENTS
• LABEL is an optional field. A ‘LABEL’ is an identifier used extensively in programs to reduce
the reliance on programmers for remembering where data or code is located. LABEL is
commonly used for representing
02/27/2025 7
Assembly Language based Development conti….
• The Assembly language program written in assembly code is saved as .asm (Assembly file)
file or an .src (source) file or an extension format supported by the tool chain/assembler
• Any text editor like ‘notepad’ or ‘WordPad’ from Microsoft® or the text editor provided by an
Integrated Development (IDE) tool can be used for writing the assembly instructions
• Similar to ‘C’ and other high level language programming, you can have multiple source
files called modules in assembly language programming
• Each module is represented by an ‘.asm’ or ‘.src’ or a file with an extension format specific
to the ttol chain/assembler used similar to the ‘.c’ files in C programming. This approach is
known as ‘Modular Programming’
02/27/2025 8
The various steps involved in the conversion of a program written in assembly language
to corresponding binary file/machine language
.
02/27/2025 9
The various steps involved in the conversion of a program written in assembly language
to corresponding binary file/machine language conti…
. • Each source module is written in Assembly and is stored as .src file or .asm file
• Each file can be assembled separately to examine the syntax errors and incorrect
assembly instructions
• On successful assembling of each .src/.asm file a corresponding object file is created
with extension ‘.obj’
• The object file does not contain the absolute address of where the generated code
needs to be placed on the program memory and hence it is called a re-locatable
segment
02/27/2025 10
. • It can be placed at any code memory location and it is the responsibility of the linker/locator
to assign absolute address for this module.
• Absolute address allocation is done at the absolute object file creation stage.
• Each module can share variables and subroutines (functions) among them.
• Exporting a variable/function from a module (making a variable/function from a module
available to all other modules) is done by declaring that variable/function as PUBLIC in the
source module
• Libraries are specially formatted, ordered program collections of object modules that may be
used by the linker at a later time. When the linker processes a library, only those object
modules in the library that are necessary to create the program are used. Library files are
generated with extension ‘.lib’
02/27/2025 11
Advantages of Assembly Language Based Development
• Efficient Code Memory and Data Memory Usage (Memory Optimization)
• High Performance
• Low Level Hardware Access
• Code Reverse Engineering
Drawbacks of Assembly Language Based Development
• High Development Time
• Developer Dependency
• Non-Portable
02/27/2025 12
THANK YOU
13