ES Module 2 Notes
ES Module 2 Notes
EMBEDDED SYSTEMS
Course Code : 18EC62
CIE Marks :40
Lecture Hours/Week : 03 + 2 (Tutorial)
SEE marks :60
Total Number of Lecture Hours : 50 (10 Hrs / Module) E
xam Hours : 03
CREDITS : 04
MODULE -2
ARM Cortex M3 Instruction Sets and Programming: Assembly basics,Instruction list and description,
Thumb and ARM instructions, Specialinstructions, Useful instructions, CMSIS, Assembly and C
languageProgramming (Text 1: Ch-4, Ch—10.1 to 10.6)
Contents: Assembly basics, Instruction list and description, Useful instructions, Memory mapping,
Bit-band operations and CMSIS, Assembly and C Language Programming.
Assembly Basics
This chapter provides some insight into the instruction set in the Cortex™-M3 and examples for
a number of instructions.
Assembler Language: Basic Syntax
In assembler code, the following instruction formatting is commonly used:
The label is optional. Some of the instructions might have a label in front of them so that the
address of the instructions can be determined using the label.
Then, the opcode (the instruction) followed by a number of operands. Normally, the first operand is
the destination of the operation. The number of operands in an instruction depends on the type of
instruction, and the syntax format of the operand can also be different.
The text after each semicolon (;) is a comment. These comments do not affect the program
operation, but they can make programs easier to understand.
www.azdocuments.in
Page 1
Embedded Systems-18EC62 Azdocuments
For example, immediate data are usually in the form #number, as shown here:
www.azdocuments.in
Page 2
Embedded Systems-18EC62 Azdocuments
The difference between thumb instruction format and Unified Assembler Language is as follows:
Unified Assembler Language (UAL) was developed to allow selection of 16-bit and 32-bit
instructions and to make it easier to port applications between ARM code and Thumb code b y
using the same syntax for both
By default, the instruction is narrow (16 bits).
Ex: MOV R1, #18 and MOV.N R1, #18 are same. (.N means narrow).
For 32 bit instructions, MOV.W R1,#18 is used. (.W means wide).
Assembler Directives
Assembler directives are instructions that direct the assembler to do something. Example:
EQU( Equate) - Constants can be defined using EQU and then it can be used in program code
Ex: NVIC_IRQ_SET EQU 0xE000E100
NVIC_IRQ_ENABLE EQU 0x1
A number of data definition directives are available for instruction of constants inside assembly code.
Example:
DCI (Define Constant Instruction) - is used to code an instruction if the assembler cannot generate the
exact instruction that the user wants and if the user know the binary code for instruction.
Ex: DCI 0xBE00 ; Breakpoint (BKPT 0) – 16 bit instruction
DCB (Define Constant Byte) – Byte size constant values such as characters can be used to define
using DCB.
Ex: LDR R0, =hellotxt
BL printtext
Hellotxt DCB ―hello\n‖, 0 ; null terminated string
DCD (Define Constant Data) – Word size constant values to define binary data in assembler code is
done through DCD.
Ex: LDR R3, = my_num
LDR R4, [R3];
my_num DCD 0x12345678
www.azdocuments.in
Page 3
Embedded Systems-18EC62 Azdocuments
Example 1 Example 2
Before Before
R1= 0x00000000 R1 = 0x00000000
R0 = 0x00000004 R0 = 0x00000004
MOV R1, R0 MVN R1, R0
After After
R1= 0x00000004 R1 = 0xFFFFFFFB
R0 = 0x00000004 R0 = 0x00000004
www.azdocuments.in
Page 4
Embedded Systems-18EC62 Azdocuments
www.azdocuments.in
Page 5
Embedded Systems-18EC62 Azdocuments
www.azdocuments.in
Page 6
Embedded Systems-18EC62 Azdocuments
www.azdocuments.in
Page 7
Embedded Systems-18EC62 Azdocuments
www.azdocuments.in
Page 8
Embedded Systems-18EC62 Azdocuments
POP {R0-R3, PC} ; restore registers and return in this case, instead of popping the LR
register back and then branching to the address in LR, we POP the address value directly in
the program counter.
www.azdocuments.in
Page 9
Embedded Systems-18EC62 Azdocuments
Example
Before Execution Instruction After Execution
R3=0x12345678H MOVT R3, #0xF8CDH R3= 0xF8CD5678H
Arithmetic instructions
Table 2.8: Examples of Arithmetic Instructions
Instruction Operation Description
ADD Rd, Rn, Rm Rd = Rn + Rm ADD operation
ADD Rd, Rd, Rm Rd = Rd + Rm
ADD Rd, #immd Rd = Rd + #immd
ADD Rd, Rn. #immd Rd = Rn + #immd
ADC Rd, Rn, Rm Rd = Rn+ Rm + carry ADD with carry
ADC Rd, Rd, Rm Rd = Rd + Rm + carry
ADC Rd, #immd Rd = Rd + #immd + carry
ADDW Rd, Rn, #immd Rd = Rn + #immd Add register with 12 bit
immediate value
SUB Rd, Rn, Rm Rd = Rn – Rm SUBTRACT
SUB Rd, #immd Rd = Rd - #immd
SUB Rd, Rn, #immd Rd = Rn - #immd
SBC Rd, Rm Rd = Rd – Rm - borrow SUBTRACT with borrow (not
SBC.W Rd, Rm,#immd Rd = Rm - #immd - borrow carry)
www.azdocuments.in
Page 11
Embedded Systems-18EC62 Azdocuments
Addition Instructions
Ex: 1. ADD R3, R1, R0
Before execution: R1=0x12345678H R0=0xABCDEF45H, R3=0x23657894H
Operation: R3=R1+R0
After execution: R3=0xBE0245BDH
www.azdocuments.in
Page 12
Embedded Systems-18EC62 Azdocuments
Subtraction Instructions
Table 2.8: Examples of Subtraction Instructions
Example 7
RSB.W R2, R1, R0
Before Execution
R1=0x00000022H, R0=0x00000049H
Operation: R2 = R0 – R1
After Execution
R2=0x00000027H
www.azdocuments.in
Page 13
Embedded Systems-18EC62 Azdocuments
Multiplication Instructions
Table 2.9: 32 bit multiply instructions
Instruction Operation
SMULL RdLo, RdHi, Rn, Rm 32 bit multiply instructions for signed
Operation: {RdHi, RdLo} = Rn * Rm values
SMLAL RdLo, RdHi, Rn, Rm
Operation: {RdHi, RdLo} + = Rn * Rm
UMULL RdLo, RdHi, Rn, Rm 32 bit multiply instructions for unsigned
Operation: {RdHi, RdLo} = Rn * Rm values
UMLAL RdLo, RdHi, Rn, Rm
Operation: {RdHi, RdLo} + = Rn * Rm
MLA R10,R1, R2, R5 Multiply with Accumulator
Operation: R10 = (R1 * R2) + R5
MLS R4, R5, R6, R7 Multiply with Subtract
Operation: R4 = R7 – (R5 * R6)
Table 2.10: Example to illustrate the difference between SMULL and UMULL instructions
Ex: -3 x 2 (smull) Ex: 3 x 2 (umull)
MOV R2, # - 0x0003 MOV R2, # 0x0003
MOV R3, # 0x0002 MOV R3, # 0x0002
Before Execution: Before Execution:
R2 = 0xFFFFFFFDH (-3), R2 = 0x00000003H (3),
R3 = 0x00000002H (2) R3 = 0x00000002H (2)
www.azdocuments.in
Page 14
Embedded Systems-18EC62 Azdocuments
Division Instructions
The mnemonic for signed and unsigned divide instructions is as follows: SDIV.W, UDIV.W.
The result is Rd = Rn/Rm
Logical instructions
Table 2.11: Logic Operation Instructions
www.azdocuments.in
Page 15
Embedded Systems-18EC62 Azdocuments
www.azdocuments.in
Page 16
Embedded Systems-18EC62 Azdocuments
Sl Examples
No. Instruction Before Execution After Execution
ASR R2, R3, #2 1. R3=0xE2352356H R2 = 0xF88d48D5H
1. 2. R3 = 0x79254361H
Operation: R2 = R3 >> 2 R2 = 0x1E4950D8H
LSL R1,#3 R1 = 0xABCD1234H R1 = 0x5E6891A0H
2.
Operation: R1 = R1 <<3
LSR R6, #1 R6 = 0xA2BC3567H R6 = 0x515E1AB3H
3.
Operation: R6 = R6 >>1
ROR R4, #5 R4 = 0x689243ACH R4 = 0x6344921DH
4. Operation: R4 = R4 rotate
right by 5
RRX R4, #3 R4 = 0x689243ACH R4 = 0x0D124875H
5. Operation: R4 = R4 rotate Carry = 0 Carry = 1
with carry by 3
www.azdocuments.in
Page 17
Embedded Systems-18EC62 Azdocuments
www.azdocuments.in
Page 18
Embedded Systems-18EC62 Azdocuments
1 BFC Rd, #<LSB>, #width Clear the bits starting from LSB bit Bit Field Clear
till the width towards MSB, rest of
the bits are unaffected.
2 BFI Rd, Rn, #<LSB>, #width Insert the source register bits from Bit Field Insert
0th bit till the width towards MSB
into the destination register bits
from LSB till width towards MSB.
Rest of the bits are unaffected.
After Execution: R1 = 0011 0100 0010 0101 0011 0011 1011 1101
R1 = 0x342533BDH, R2 = 0xDCBC4533H
www.azdocuments.in
Page 19
Embedded Systems-18EC62 Azdocuments
5 UBFX.W <Rd>, <Rn>, Extracts a bit field from a register starting Unsigned Bit
<#LSB>. <#width> from any location (specified by LSB) with Field Extraction
any width (specified by #width), zero
extends it, puts in destination register
Example: LDR R0, =0x5678ABCDH
UBFX.W R1, R0, #4, #8
R1 = 0x000000BCH
6 SBFX.W <Rd>, <Rn>, SBFX extracts a bit field, but its sign Signed Bit Field
<#LSB>. <#width> extends it before putting it in a Extraction
destination register.
Example: LDR R0,=0x5678ABCDH
SBFX.W R1,R0,#4, #8
R1 = 0xFFFFFFBCHs
www.azdocuments.in
Page 20
Embedded Systems-18EC62 Azdocuments
BLX reg ; Branch to an address specified by a register and save return address in LR.
With these instructions, the return address will be stored in the link register (LR) and the function can be
terminated using BX LR, which causes program control to return to the calling process. However, when using
BLX, make sure that the LSB of the register is1. Otherwise the processor will produce a fault exception
because it is an attempt to switch to the ARM state. You can also carry out a branch operation using
MOV instructions and LDR instructions. For example,
The BL instruction will destroy the current content of LR. So, the program code needs the LR
later, we should save LR before use BL. The common method is to push the LR to stack in the
beginning of subroutine. For example,
main
...
BL functionA
... functionA
PUSH {LR} ; Save LR content to stack ...
BL functionB ...
POP {PC} ; Use stacked LR content to return to main
functionB PUSH {LR}
...
POP {PC} ; Use stacked LR content to return to functionA
In addition, if the subroutine you call is a C function, you might also need to save the contents
in R0–R3 and R12 if these values will be needed at a later stage.
www.azdocuments.in
Page 21
Embedded Systems-18EC62 Azdocuments
Table 2.16: Flag Bits in APSR that Can Be Used for Conditional Branches
Flag PSR Bit Description
N 31 Negative flag(last operation result is a negative value)
Z 30 Zero (last operation result is a zero value)
C 29 Carry flag (last operation returns a carry out or borrow)
V 28 Overflow (last operation results in an overflow)
Z (Zero) flag: This flag is set when the result of an instruction has a zero value or when a comparison of
two data returns an equal result.
N (Negative) flag: This flag is set when the result of an instruction has a negative value (bit 31 is 1).
C (Carry) flag: This flag is for unsigned data processing—for example, in add (ADD) it is set when an
overflow occurs; in subtract (SUB) it is set when a borrow did not occur (borrow is the invert of carry).
V (Overflow) flag: This flag is for signed data processing; for example, in an add
(ADD), when two positive values added together produce a negative value, or when two negative values
added together produce a positive value.
With combinations of the four flags (N, Z, C, and V ), 15 branch conditions are defined (see Table 2.17).
Using these conditions, branch instructions can be written,
For example, BEQ label ; Branch to address 'label' if Z flag is set.
We can also use the Thumb-2 version if your branch target is further away.
For example, BEQ.W label; Branch to address 'label' if Z flag is set.
www.azdocuments.in
Page 22
Embedded Systems-18EC62 Azdocuments
The defined branch conditions can also be used in IF-THEN-ELSE structures. For example,
CMP R0, R1 ; Compare R0 and R1
ITTEE GT ; If R0 > R1 Then if true, first 2 statements execute, if false, other 2 statements execute
MOVGT R2, R0 ; R2 = R0
MOVGT R3, R1 ; R3 = R1
MOVLE R2, R0 ; Else R2 = R1
MOVLE R3, R1 ; R3 = R0
The compare (CMP) instruction subtracts two values and updates the flags (just like SUBS), but the result is
not stored in any registers. CMP can have the following formats:
A similar instruction is the CMN (compare negative). It compares one value to the negative (two‘s
www.azdocuments.in
Page 23
Embedded Systems-18EC62 Azdocuments
complement) of a second value; the flags are updated, but the result is not stored in any registers:
CMN R0, R1 ; Calculate R0 – (-R1) and update flag
CMN R0, #0x12 ; Calculate R0 – (-0x12) and update flag
The TST (test) instruction is more like the AND instruction. It ANDs two values and updates the flags.
However, the result is not stored in any register. Similarly to CMP, it has two input formats:
www.azdocuments.in
Page 24
Embedded Systems-18EC62 Azdocuments
If a statement is to be executed when <cond> is false, the suffix for the instruction must be the opposite of the
condition. For example, the opposite of EQ is NE, the opposite of GT is LE, and so on. The following code
shows an example of a simple conditional execution:
if (R1<R2) then
R2=R2−R1
R2=R2/2
else
R1=R1−R2
R1=R1/2
In assembly,
We can have fewer than four conditionally executed instructions. The minimum is 1. we need to make sure the
number of T and E occurrences in the IT instruction matches the number of conditionally executed instructions
after the IT.
If an exception occurs during the IT instruction block, the execution status of the block will be stored in the
stacked PSR (in the IT/Interrupt-Continuable Instruction [ICI] bit field). So, when the exception handler
completes and the IT block resumes, the rest of the instructions in the block can continue the execution
correctly. In the case of using multicycle instructions (for example, multiple load and store) inside an IT
block, if an exception takes place during the execution, the whole instruction is abandoned and restarted after
the interrupt process is completed.
Instruction Barrier and Memory Barrier Instructions
The Cortex-M3 supports a number of barrier instructions. These instructions are needed as memory systems
get more and more complex. In some cases, if memory barrier instructions are not used, race conditions
could occur.
For example, if the memory map can be switched by a hardware register, after writing to the memory
switching register you should use the DSB instruction. Otherwise, if the write to the memory switching
register is buffered and takes a few cycles to complete, and the next instruction accesses the switched memory
region immediately, the access could be using the old memory map. In some cases, this might result in an
invalid access if the memory switching and memory access happen at the same time. Using DSB in this case
will make sure that the write to the memory map switching register is completed before a new instruction is
executed.
The following are the three barrier instructions in the Cortex-M3:
• DMB
• DSB
• ISB
www.azdocuments.in
Page 25
Embedded Systems-18EC62 Azdocuments
The DSB and ISB instructions can be important for self-modifying code. For example, if a program changes
its own program code, the next executed instruction should be based on the updated program. However, since
the processor is pipelined, the modified instruction location might have already been fetched. Using DSB and
then ISB can ensure that the modified program code is fetched again.
Architecturally, the ISB instruction should be used after updating the value of the CONTROL register. In the
Cortex-M3 processor, this is not strictly required. But if you want to make sure your application is portable,
you should ensure an ISB instruction is used after updating to CONTROL register.
DMB is very useful for multi-processor systems. For example, tasks running on separate processors might use
shared memory to communicate with each other. In these environments, the order of memory accesses to the
shared memory can be very important. DMB instructions can be inserted between accesses to the shared
memory to ensure that the memory access sequence is exactly the same as expected.
Instruction Description
Data memory barrier; ensures that all memory accesses are completed before new memory
DMB
access is committed
Data synchronization barrier; ensures that all memory accesses are completed
DSB
before next instruction is executed
Instruction synchronization barrier; flushes the pipeline and ensures that all previous
ISB
instructions are completed before executing new instructions
Saturation Operations
The Cortex-M3 supports two instructions that provide signed and unsigned saturation operations: SSAT and
USAT (for signed data type and unsigned data type, respectively). Saturation is commonly used in signal
processing—for example, in signal amplification. When an input signal is amplified, there is a chance that the
output will be larger than the allowed output range. If the value is adjusted simply by removing the unused
MSB, an overflowed result will cause the signal waveform to be completely deformed.
The saturation operation does not prevent the distortion of the signal, but at least the amount of distortion is
greatly reduced in the signal waveform.
www.azdocuments.in
Page 26
Embedded Systems-18EC62 Azdocuments
Instruction Description
SSAT.W <Rd>, #<immed>, <Rn>, {,<shift>} Saturation for signed value
USAT.W <Rd>, #<immed>, <Rn>, {,<shift>} Saturation for a signed value into an unsigned value
Rn: Input value
Shift: Shift operation for input value before saturation; optional, can be #LSL N or #ASR N Immed: Bit
position where the saturation is carried out Rd: Destination register
Besides the destination register, the Q-bit in the APSR can also be affected by the result. The Q flag is set if
saturation takes place in the operation, and it can be cleared by writing to the APSR.
For example, if a 32-bit signed value is to be saturated into a 16-bit signed value, the following instruction can be
used:
Table 2.20: Examples of Signed Saturation Results Table 2.21: Examples of Unsigned Saturation Results
www.azdocuments.in
Page 27
Embedded Systems-18EC62 Azdocuments
Memory Maps
The Cortex-M3 processor has a fixed memory map. This makes it easier to port software from one Cortex- M3
product to another. For example, components described in previous sections, such as Nested Vectored Interrupt
Controller (NVIC) and Memory Protection Unit (MPU), have the same memory locations in all Cortex-M3 products.
Nevertheless, the memory map definition allows great flexibility so that manufacturers can differentiate their Cortex-
M3-based product from others.
www.azdocuments.in
Page 28
Embedded Systems-18EC62 Azdocuments
Bufferable: Write to memory can be carried out by a write buffer while the processor continues on
next instruction execution.
Cacheable: Data obtained from memory read can be copied to a memory cache so that next time it
is accessed the value can be obtained from the cache to speed up the program execution.
Executable: The processor can fetch and execute program code from this memory region. Sharable: Data in this
memory region could be shared by multiple bus masters. Memory system needs to ensure coherency of data between
different bus masters in shareable memory region
Code - This executable region is for program code. Data can also be stored here. This region is Executable,
Cacheable, Bufferable
SRAM - This executable region is for data storage. Code can also be stored here. This region includes bit band and bit
band alias areas. This region is Executable, Cacheable, Bufferable
SRAM Bit-band alias - Direct accesses to this memory range behave as SRAM memory accesses, but this region is
also bit addressable through bit-band alias.
SRAM bit-band region - Data accesses to this region are remapped to bit band region. A write operation is
performed as read-modify-write.
PERIPHERAL - This region includes bit band and bit band alias areas. Instruction Execution not allowed
This region is Non-executable, Non-Cacheable, Bufferable.
Peripheral Bit-band alias - Direct accesses to this memory range behave as peripheral memory accesses, but this
region is also bit addressable through bit-band alias.
Peripheral bit-band region - Data accesses to this region are remapped to bit band region. A write operation is
performed as read-modify-write.
EXTERNAL DEVICE - This region is used for external device and Shared memory
Non-executable, Non-Bufferable
EXTERNAL RAM - This region is intended for either on-chip or off-chip memory and this region is used for data.
Executable, Cacheable.
SYSTEM LEVEL This region is for private peripherals and vendor-specific devices.It is nonexecutable.
PPB memory range-noncacheable, nonbufferable
Vendor-specific memory region- bufferable and noncacheable.
www.azdocuments.in
Page 29
Embedded Systems-18EC62 Azdocuments
Figure 1.6 Bit Accesses to Bit-Band Region via the Bit-Band Alias
www.azdocuments.in
Page 30
Embedded Systems-18EC62 Azdocuments
Figure 1.8 Example Assembler Sequence to Write a Bit with and without Bit-Band
Table 2.21: Remapping of Bit-Band Addresses Table 2.22: Remapping of Bit-Band Addresses in
SRAM Region Peripheral Memory Region
Bit-band region: This is a memory address region that supports bit-band operation.
Bit-band alias: Access to the bit-band alias will cause an access (a bit-band operation) to the bit-band region.A
memory remapping is performed
www.azdocuments.in
Page 31
Embedded Systems-18EC62 Azdocuments
Cortex-M3 Programming
The Cortex™-M3 can be programmed using either assembly language, C language, or other high-level
languages like National Instruments LabVIEW.
For most embedded applications using the Cortex-M3 processor, the software can be written entirely
in C language.
There are of course some people who prefer to use assembly language or a combination of C and
assembly language in their projects.
The concepts of code generation flow in terms of these tools are similar.
For the most basic uses, you will need assembler, a C compiler, a linker, and binary file generation
utilities.
For ARM solutions, the Real View Development Suite (RVDS) or Real View Compiler Tools (RVCT)
provide a file generation flow
www.azdocuments.in
Page 32
Embedded Systems-18EC62 Azdocuments
Using Assembly
For small projects, it is possible to develop the whole application in assembly language.
Using assembler, best optimization is possible, but it increases the development time.
Handling complex data structures or function library management can be extremely difficult.
Even when the C language is used in a project, in some situations part of the program is implemented in
assembly language as follows:
Functions that cannot be implemented in C, such as direct manipulation of stack data or special instructions
that cannot be generated by the C compiler in normal C-code.
Timing-critical routines.
Tight memory requirements, causing part of the program to be written in assembly to get the
smallest memory size.
In various situations, assembly code and the C program interact. For example:
www.azdocuments.in
Page 33
Embedded Systems-18EC62 Azdocuments
while (1) {
return 0;
www.azdocuments.in
Page 34
Embedded Systems-18EC62 Azdocuments
Areas of standardization
Hardware Abstraction Layer (HAL) for Cortex-M processor registers: This includes standardized
register definitions for NVIC, System Control Block registers, SYSTICK register, MPU registers, and a
number of NVIC and core feature access functions.
Standardized system exception names: This allows OS and middleware to use system exceptions
easily without compatibility issues.
Standardized method of header file organization: This makes it easier for users to learn new cortex
microcontroller products and improve software portability.
Common method for system initialization: Each Microcontroller Unit (MCU) vendor provides a
SystemInit() function in their device driver library for essential setup and configuration, such as
initialization of clocks.
Standardized intrinsic functions: By having standardized intrinsic functions, software reusability
and portability are considerably improved.
Common access functions for communication: This provides a set of software interface functions for
common communication interfaces including universal asynchronous receiver/transmitter (UART),
Ethernet, and Serial Peripheral Interface (SPI).
Standardized way for embedded software to determine system clock frequency: A software variable
called System Frequency is defined in device driver code. This allows embedded OS to set up the
SYSTICK unit based on the system clock frequency
Organization of CMSIS
2. Middleware Access Layer: Common method to access peripherals for the software industry. Targeted
communication interfaces include Ethernet, UART and SPI. Allows portable software to perform
communication tasks on any Cortex microcontrollers that support the required communication
interface.
3. Device Peripheral Access Layer (MCU specific): Name definitions, address definitions, and driver code to
access peripherals
4. Access Functions for Peripherals (MCU specific): Optional additional helper functions for peripherals
www.azdocuments.in
Page 35
Embedded Systems-18EC62 Azdocuments
Using CMSIS
Since the CMSIS is incorporated inside the device driver library, there is no special setup requirement for
using CMSIS in projects.
For each MCU device, the MCU vendor provides a header file, which pulls in additional header files required
by the device driver library, including the Core Peripheral Access Layer defined by ARM.
The file core_cm3.h contains the peripheral register definitions and access functions for the
Cortex-M3 processor peripherals like NVIC, System Control Block registers, and SYSTICK
registers.
The core_cm3.h file also contains declaration of CMSIS intrinsic functions to allow C applications to access
instructions that cannot be generated using IEC/ISO C language. In addition, this file also contains a function
for outputting a debug message via the Instrumentation Trace Module (ITM).
The system_<device>.h file contains microcontroller specific interrupt number definitions, and
peripheral register definitions.
The system_<device>.c file contains a microcontroller specific function called SystemInit for system
initialization.
In addition, CMSIS compliant device drivers also contain start-up code (which contains the vector table
www.azdocuments.in
Page 36
Embedded Systems-18EC62 Azdocuments
CMSIS Files
Benefits of CMSIS
Allows software to be quickly ported between Cortex-M3 and other Cortex-M processors, reducing time
to market. For embedded OS vendors and middleware providers, the advantages of the CMSIS are
significant.
By using the CMSIS, their software products can become compatible with device drivers from
multiple microcontroller vendors.
Without the CMSIS, the software vendors either have to include a small library for Cortex-M3 core functions or
develop multiple configurations of their product so that it can work with device libraries from different
microcontroller vendors.
www.azdocuments.in
Page 37
Embedded Systems-18EC62 Azdocuments
Recommended Questions
1. What do you mean by UAL? Give example instructions indicating its relevance
2. How the data definition directives are used in ARM Cortex-M3? Provide example instructions.
3. How the suffixes are used in assembler language? Provide example instructions to use suffixes.
4. Explain the data movement instructions in ARM cortex M3.
5. Write a note on LDR and ADR Pseudo-Instructions.
6. Explain the arithmetic instruction set in ARM cortex M3 with an example
7. Explain the logical instruction set in ARM cortex M3 with an example
8. Explain the shift and rotate instructions available in ARM cortex M3 with an example
9. Analyze the following instructions and write the contents of the registers after the execution of
each instruction
Assume: R0=0x00000088, R1=0x00001111, R2=0x000000A
ADD R3,R0,R1
BIC R4,R1,#0X04
ORR R4, R2
REV R5,R4
10. Explain the following instructions with suitable example:
www.azdocuments.in
Page 38
Embedded Systems-18EC62 Azdocuments
11. Briefly describe the branch (unconditional and conditional branch) and call instructions in ARM
cortex M3.
13. Explain the IF THEN (IT) instruction in ARM Cortex M3 with an example.
14. Describe the instruction barrier and memory barrier instructions in arm cortex m3.
15. Write the memory map and explain memory access attributes in Cortex M3.
16. Describe the Bit-band operations in ARM cortex M3 and mention its advantages
18. Explain the typical program development flow in Arm cortex M3 and describe how to interface assembly and
C language.
www.azdocuments.in
Page 39