Professional Documents
Culture Documents
2.1 Introduction PDF
2.1 Introduction PDF
1 INTRODUCTION
Tuesday, May 26, 2020 11:16 AM
This description is called the programmer's model. We´ll begin by examining the basic parts of the ARM7TDMI and Cortex-M4
programmer's models.
☺ Byte, or 8 bits
☺ Halfword, or 16 bits
☺ Word or 32 bits
So you will need two bytes to create a Thumb instructions and four bytes to create either an ARM instructions or a Thumb-2
instructions.
When reading ro writing data, halfwords must be aligned to two-bytes boundaries, which means that the address in memory
must end in an even number. Words must be aligned to four-byes boundaries, i.e addresses ending 0,4,8 or C.
Boundaries =
The Cortex-M4 allows unaligned accesses under certain conditions, so it is actually possible ro read or write a word of data
limites
located at an odd address. EITHER = YA SEA
Even = par
Odd = impar
3.2 ARM7TDMI
Older programmer's model is to show its similarity to the more advanced cores-The Cortes-A and Cortex-R processor.
It is also noteworthy to point out features that are common to all ARM processor but differ by number, use, and limitations.
Version 4t cores support seven processor modes: User, FIQ,IRQ,Supervisor,Abort, Undefined, and System,
Abort mode allows the processor to recover from exceptional conditions such as a memory access to an address that doesn´t
The processor will switch to Undefined mode when it sees an instruction in the pipeline that it does not recognize;
2.3.2 REGISTERS
The register is the most fundamental storage area on the chip. You can put: data values, timer, a counter, or a coefficient for an
FIR filter; or addresses , table, memory.
The general-purpose register are 32 bits wide, the registers are arranged in partially overlapping bank.
Wide = ampli@
15 general-purpose register(R0 to R14), and the program Counter (PC or 15) are visible.
Overlapping = superposición
Register R14(the Link Register)
The current program Status Register (CPSR) can be seen as the state of the machine allowing programs to recover from
exceptions ro branch on the results of an operation. It contains condition code flags, interrupt enable flags, the current mode,
Each privileged mode (except System mode) has a Saved Program Status Register (SPSR) that is used to prserve the value of the
CPSR when an exception accurs. Since User mode and System mode are not entered on any exception.
The format of the Current Program Status Register and the Saved Program Status Register is that it contians four bits at the top,
collectively know as the condition code flags.
The condition code flags in the CPSR can be altered by arithmetic and logical instructions, such as subtractions logical shifts, and
rotations.
The bottom eight bits of a status register are known as the control bits. The I and F bits are the interrupt disable bits, which
disable interrupts in the processor if they are set. The I bit control the IRQ interrupts, and the F bit controls the FIQ interrupts.
The T bit is a status bit, menat only to indicate the state of the machine, so as a programmer you woild only read this bit, not
write to it, if the bit is set to 1, the core is executing Thumb code, which consists of 16-bit instructions.
Table 2.1 shows the interpretation of the least significant bits in the PSRs, whick determine the mode in which the processor
operates.
So the next instruction that the machine will likely fetch is a branch (B) instruction, assuming the programmer
put such an instruction at address 0x18. Once this branch instruction is executed,
2.4 CORTEX-M4
These cores are designed to be used in applications that require 32-bit processors to achieve high code
density, fast interrupt response times.
2.4.2 REGISTERS
If you have a Cortex-M4 that includes a floating-point unit. There are actually more.The Cortex-M4 with
floating-point hardware contains the following registers as part of the programmer´s model:
☺ 17 genaral purpose register, i.e., registers than can hold any value
☺ A status register than can be viewed in its entirety or in three specialized views
☺ 3 Interrupt mask registers
☺ A control Regiter
☺ 32 single-precision floating-point registers (S0-s31) or 16 double-precision registers (do- d15) or a mix
☺ 4 Floating-point control register (Although these are memory-mapped, not physical registers)
Stack = apilar
Recorte de pantalla realizado: 5/30/2020 10:14 AM
Register R0 through R12 are general purpose registers, and the registers hold 32-bit values that can be
anything you like addresses,data,packed data, fractional data values, anything. Thera are some special purpose
registers, such as register R13, the stack pointer(and there are two of them, giving you the ability to work with
separate stacks).
Register R14, the Link Register, and Register R15, which is the Program Counter. Register R13 (the Stack
pionter or SP) holds the address of the stack in memory, only there are just two of them in the Cortex-M4.
There is only one Link Register. Register R15, the Program Counter or PC, points to the instruction being
fetched, but due to pipelining, there are enough corner cases to make hard and fast rules about its value
difficult.
The Application Program Status Register (APSR), the Interrupt Program Status Register(IPSR), and the
Execution Program Status Register (EPSR) are just three specialized views of the same register. The APSR
contians the status flags(N,C,V AND Z), the Greater Than or Equal flags(used by the SEL instruction), and an
additional "sticky" Q flag used in saturation arithmetic
The last special purpose register is the Control register, which consists of only three bits, The least significant
bit, CONTROL[0], changes the access level while in Thread mode to either a Prvileged or User level. The next
most significant bit, CONTROL[1], selects which stack the processor is to use, either the Main Stack Pointer
(MSP), The most significant bit, CONTROL[2], indicates whether or not to preserve the floating-point state
during exception processing.