Arm Notes-1
Arm Notes-1
ARM Core Adaptations for Embedded Systems Hybrid Architecture ARM core not a pure
RISC architecture due to the constraints of embedded systems. Performance & Power
Consumption Focusing on total effective system performance and power consumption
over raw processor speed. Code Optimization Introduction of Thumb 16-bit instruction
set for improved code density.
ARM Instruction Set for Embedded Systems Variable Cycle Execution Enhances
performance and code density for specific instructions like load-store-multiple
instructions. Code Density Enhancement Inline barrel shifter adds complexity but
enhances core performance and code density. Thumb 16-bit instruction set Support fast
operations, including DSP instructions for 16×16- bit multiplier operations. Conditional
execution This feature improves performance and code density by reducing Branch
instructions Enhanced Instructions These instructions allow a faster-performing ARM
processor in some cases to replace the traditional combinations of a processor plus a
DSP.
Basically, there are two types of registers – General purpose registers and Special purpose
registers. General-purpose registers hold either data or an address. The letter r is prefixed to the
register number to identify them. For example, the label r4 is assigned to register 4. Figure
depicts the active registers that are available in user mode, which is a protected state that is often
utilized for running programs. There are seven various modes that the CPU may work in, which
we shall go through momentarily. The registers in this example are all 32 bits in size. Up to 18
active registers are available: 16 data registers and 2 processor status registers. The data registers
are labeled r0 through r15 by the programmer. The ARM processor contains three registers: r13,
r14, and r15, each of which is allocated to a specific duty or unique function. To distinguish them
from the other registers, they are typically given separate labels. The colored registers indicate
which special-purpose registers have been allocated.
Register 13 is traditionally used as the stack pointer (SP) and stores the head of
the stack in the current processor mode.
Register r14 is called the link register (LR) and is where the core puts the return
address whenever it calls a subroutine.
Register 15 is the program counter (PC) and contains the address of the next
instruction to be fetched by the processor.
ARM Operating Modes
In this Operating modes in ARM, On reset, the ARM7 enters this mode. Its purpose is to run the
BIOS software (Booting program). SWI can also be used by the programmer to activate this
mode (Software Interrupt). For example, there are two distinct privileges on our phone or
computer. The supervisor mode is one, while the user mode is the other. These two modes are
separated by the amount of protection they provide. When you’re in supervisor mode, you have
access to both system and user data. When in user mode, however, you can only access user data.
Because of the system’s security level, you do not have authorization to view the data.
This is the default mode, which runs all user programmes. It’s the only mode that isn’t
privileged. Memory, I/O components, and flags are all restricted. All of the other modes can be
accessed via a variety of exceptions (interrupts). After leaving supervisor mode, the
microcontroller enters user mode and remains there until you turn it off. Remember This does
not go straight to user mode when you start it. It is first handled by the supervisor mode, after
which the supervisor mode switches to user mode. The ARM processor spends more than 95% of
its time in user mode over its lifespan. You may access all other modes from this mode.
In this Operating modes in ARM, Its a privileged version of user mode. This mode may be used
by the User application to get complete control over CPSR and Memory. Needless to say, the
programmer should utilise this mode with extreme caution, otherwise the entire protective
mechanism may be jeopardised.
When you make a system call, you automatically enter system mode. For example, on our phone,
if we wish to modify certain settings or adjust the brightness of our phone. We know that all we
have to do is move the cursor left and right. However, it then sends a system call to alter the
brightness of your phone before returning to normal user mode.
In this Operating modes in ARM, Fast Interrupt Request ModeWhen a high priority interrupt is
received through the nFIQ pin, this mode is activated. Because this mode is used for high-
priority interruptions, the ISR should run as quickly as possible (delay). Normally, when we start
an ISR, the original values of all GPRs in the parent programme must be preserved, and these
values must be restored into the GPRS before the ISR is completed so that the main programme
may continue properly. This consumes a lot of time, which causes Interrupt Latency to rise. A
fresh copy of R8-R14 is utilised when a fast Interrupt request is sent. This eliminates the need to
save and restore these registers, making the ISR significantly quicker to perform. As a result, it’s
known as Fast Interrupt Mode.
In this Operating modes in ARM , When an attempt to access a memory location fails, this mode
is activated. Specific areas are inaccessible in some settings due to the protection system. When
an attempt is made to access one of these locations, the CPU enters Abort mode, and the
programme that attempted to access it is terminated. When we go from user to supervisor mode
and try to access system data or a system application that the user does not have the authorization
to access, it goes into abort mode, kills the operation, and returns to user mode.
Undefined instructions are entered in this mode. When a co-processor instruction is encountered
but no co-processor is available in the system, this happens. The CPU then enters Undefined
mode, terminating the programme that was attempting that instruction.
CONDITIONAL EXECUTION
Conditional execution controls whether or not the core will execute an instruction. Most
instructions have a condition attribute that determines if the core will execute it based on the
setting of the condition flags. Prior to execution, the processor compares the condition attribute
with the condition flags in the cpsr. If they match, then the instruction is executed; otherwise the
instruction is ignored.
The condition attribute is postfixed to the instruction mnemonic, which is encoded into the
instruction. Table 2.5 lists the conditional execution code mnemonics. When a condition
mnemonic is not present, the default behavior is to set it to always (AL) execute.
ARM Pipelining :
A Pipelining is the mechanism used by RISC(Reduced instruction set
computer) processors to execute instructions,
by speeding up the execution by fetching the instruction, while other instructions
are being decoded and executed simultaneously.
Which in turn allows the memory system and processor to work continuously.
The pipeline design for each ARM family is different.
Pipelining is a design technique or a process which plays an important role in increasing the
efficiency of data processing in the processor of a computer and microcontroller. By keeping
the processor in a continuous process of fetching, decoding and executing called (F&E cycle).
ARM devices need pipelining because of RISC as it emphasizes on compiler complexity. Each
stage is equivalent to 1 cycle, that is n stages = n cycles.
Pipeline
Exception handling
What is a vector table in ARM?
The vector table is an array of addresses. The very first entry is the initial stack pointer
after reset, all others are addresses of exception / interrupt handlers (functions). The
first handler (Reset_Handler) address is loaded by the MCU as initial program counter
after reset.