From the programming point of view, the ARM microprocessor has two working states and can switch between them:
(1) arm status. At this time, the processor executes the 32-bit arm command
(2) thumb status. At this time, the processor executes a 16-bit, semi-aligned thumb command (to be compatible with the old chip)
During the process of running the program, you can switch between the two States. The change of the processor's working status does not affect the working mode of the processor and the content in the corresponding register.
Memory Format (Word Alignment ):
The ARM architecture regards memory as a linear combination of bytes starting from zero addresses. Place the first stored word (32-bit) data from zero byte to three bytes, and place the second stored word data from the fourth byte to the seventh byte at a time. As a 32-bit microprocessor, the maximum addressing space supported by the ARM architecture is 4 GB.
Memory Format:
The ARM architecture can store word data in two ways, namely big-end format and small-end format.
Large-end format: the high byte of word data is stored in the low address, while the low address of word data is stored in the high address.
Small-end format: opposite to the large-segment format.
Instruction length:
The instruction length of the ARM microprocessor is 32 bits, or 16 bits (in the thumb State ). ARM microprocessor supports three data types: byte (8 bits), half-character (16 bits), and word (32 bits). Among them, the word must be 4-byte aligned, the half word must be 2 bytes aligned.
Note: the so-called instruction length is the length of a complete instruction, rather than simply the length of the three letters mov
Arm working mode:
ARM microprocessor supports seven working modes:
1. User Mode (usr)
Used for normal Program Execution
2. Fast interrupt mode (FIQ)
For high-speed data transmission
3. External Interrupt mode (IRQ)
Used for normal interrupt handling
4. Management Mode (SVC)
Operating system protection mode (high permission)
5. Data Access termination mode (ABT)
This mode is used for virtual memory and storage protection when data or command prefetch is terminated.
6. System Mode (sys)
Run operating system tasks with privileges
7. undefined command termination mode (UND)
This mode is used to support hardware when undefined commands are executed.
There are two ways to switch the working mode of arm:
Passive switch: When the arm is running, some exceptions or interruptions are generated to switch through the active mode.
Active switch: The software changes, that is, the software sets registers to switch the arm mode. Therefore, the operating mode of the arm can be switched by assigning values to the corresponding registers.
TIPS: When the processor runs in user mode, some protected system resources cannot be accessed.
Classification of working modes:
Except for the user mode, all the other six modes are called non-user mode (privileged mode, with higher permissions than user mode ), in the privileged mode, five modes except the system mode are called the exception mode (in the user mode and system mode, these are all exceptions), which are often used to handle interruptions or exceptions, and access to protected system resources.