📜 ⬆️ ⬇️

A little bit about the architecture of the ARM7TDMI processors

Recently, I often meet about a variety of devices running on processors with ARM architecture. In this article I want to start a story about the architecture of ARM7TDMI processors (not to be confused with ARMv7). ARM7TMI is a rather outdated family, but it is rather widely used in various embedded devices. Since my work is very closely connected with the development of such devices, I am pretty well guided in this particular family. But if someone is interested, I can tell you about newer ARM families.



general description


I must say that ARM is just an architecture, on the basis of which many different processors are built. They may have completely different peripherals, different methods of interaction with peripherals, different frequencies and power consumption, but they are united by one thing - the ARM processor core.
')
ARM7 on the one hand is pretty simple (especially compared to x86), on the other hand it has more performance and less power consumption. But a smaller set of commands and the fact that the length of a command is fixed leads to an increase in the volume of programs.

Differences from x86


I hope many of those who read this article even know in general the x86 architecture :)
What is the ARM7 different from x86?

Registers

ARM has 32 registers 32 bits long. In fact, only 16 of them are simultaneously available. The remaining registers are switched along with the processor modes. All registers are completely the same (compare with x86, where even general registers have different properties). True, one of the registers, r15, is used as an instruction counter (program counter), it even has an alias - pc. So it is obvious that it should not be used as a general-purpose register :)
The other register, r14, is used as a stack pointer (stack pointer) and has an alias sp. But no one bothers to use it as a normal working register, if you suddenly don’t need a stack. Although it is not recommended.
The third register, r13, by convention stores the return address from the current function. Just like the previous register, it can be used as a working one.
The remaining 13 registers can be used by the programmer (although more often the compiler) as he wants.
Plus, there are 2 more dedicated processor status registers. In fact, the same register, just one of his hypo contains the saved data after switching the mode.

Modes of operation

The processor can operate in 7 different modes: User, FIQ, IRQ, Supervisor, Abort, System, Undefined. 4 of these modes (FIQ, IRQ, Undefined, Abort) are listened to to handle exceptional operations — handling quick interrupts, handling normal interrupts, trying to execute an unknown instruction, trying to access a non-existent memory area (or at a non-aligned address). Abort and Undefined modes allow you to emulate coprocessor instructions and add virtual memory support, respectively.
The remaining three modes are used to protect the operating system from application programs.
It is curious that all modes (except System) have their own registers r13 and r14. Thus, when switching modes, there is no need to save the values ​​of the top of the stack and the return address.

Command set

The processor supports two sets of commands - ARM and Thumb (and the modification of ARM7EJ-S also commands for hardware acceleration java). The main difference between ARM and Thumb is the length of the command. In the first case, it is 32 bits, in the other - 16. Programs on Thumb, on average, take up less space, but also take longer to complete.
The main differences between ARM and x86 commands are:


Other


There are many more differences, such as the lack of commands for working with floating-point numbers, commands for working with decimal-binary numbers, the prohibition of references to unaligned addresses in memory, the DSP and Jazelle extensions, the lack of input-output ports (all peripherals to memory), only linear addressing (although pages can be switched if MMU is present), clever forwarding command modifiers to use bit shifts.

In general, if someone is interested, I can tell you more about AWPs, specifically about the AT91SAM7x processor, about the embedded development in general and in particular.

Source: https://habr.com/ru/post/87039/


All Articles