ARM(Advanced RISC Machine) is the name of company, a set of microprocessor, and one kind of technology. The RISC design simplify structure of processor, reduce complex instructions, and support processor extension.
The mainstream movement from MISC to RISC relays on the development of memory.
==RISC-V open source.==
Basic data processing instructions (no multiplication).
Byte/half word/word load/store.
ADD AX, [BX];
LD R1, [R2];
ADD R1, R1;
CLZ
: Count leading zero. Due to the development of encryption technique.Two operation status includes for Cortex-M4:
Thumb status. When the processor is executing instructions (Thumb 16-bit instruction or 32-bit instruction).
Debug status. When the processor paused because it reaches the breakpoint (or some other reasons).
Two mode includes for Cortex-M4:
Two priviledges included for Cortex-M4:
The process in deprivileged level calls the system call named SVC(supervisor calls) to enter the privileged level.
stateDiagram
ProcessMode --> ProcessingMode
ProcessMode --> ThreadMode
There are 32-bit registers Cortex-M4 process, classified to 7 types: 4 types of general registers and 3 types of special registers:
stateDiagram
%%state ARM_Cortex-M4_Registers {
Registers --> GeneralRegister
Registers --> SpecialRegister
GeneralRegister --> bit32GeneralRegister
bit32GeneralRegister --> LowRegisterR0_R7
bit32GeneralRegister --> HighRegisterR8_R12
GeneralRegister --> R13_SP
GeneralRegister --> R14_LR
GeneralRegister --> R15_PC
SpecialRegister --> PSR
SpecialRegister --> PRIMASK
SpecialRegister --> CONTROL
%%}
Code | Type | Priority | Description |
---|---|---|---|
0 | - | - | No exception |
1 | Reset | -3 | Reset |
2 | NMI | -2 | Non-maskable interruption |
3 | Catastrophic faults | -1 | All of the faults will cause catastrophic fault when the configurable fault handing process is prohibited |
… | … | … | … |
16 | IRQ #0 | Programmable | IO interrupt #0 |
17 | IRQ #1 | Programmable | IO interrupt #1 |
… | … | … | … |
255 | IRQ # 239 | Programmable | IO interrupt #239 |
When an exception arised, the processor first push the 8 registers into stack:
Address | N-8 | N-4 | N-32 | N-28 | N-24 | N-20 | N-16 | N-12 |
---|---|---|---|---|---|---|---|---|
Data | PC | PSR | R0 | R1 | R2 | R3 | R12 | LR |
stateDiagram
UserThreadMode --> PriviledgedHandlerMode : Raise Exception
PriviledgedHandlerMode --> UserThreadMode : Exception Return
privilegedThereadMode --> UserThreadMode : Change register `CONTROL`
privilegedThereadMode --> PriviledgedHandlerMode : Raise Exception
PriviledgedHandlerMode --> privilegedThereadMode : Exception Return