ARM Microprocessor Programming Model

Publisher:美梦小狮子Latest update time:2015-11-17 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
【Contents of this chapter】
Understand the structural characteristics of ARM
Understand the working mode of ARM programming
Learn about ARM's internal resources
Understand ARM's exception handling mechanism
 
【Chapter Structure】
[ARM microprocessor programming model]
 
 
【Working status of ARM microprocessor】
The ARM9 processor core uses the VT4 version of the ARM structure and has two operating states.
1) ARM state: 32 bits, executing word-mode ARM instructions;
2) Thumb state: 16 bits, executing half-word Thumb instructions;
(Both ARM and Thumb states are executing programs, but the length of the commands is different, similar to the nitrogen state and normal state in KartRider)
 
Register working mode
 
1) User and system modes;
 
[ARM microprocessor programming model]
(It feels similar to normal users and super users in Linux)
 
2) Abnormal mode
[ARM microprocessor programming model]
 
3) 7 register working modes supported by ARM9 processor
 
[ARM microprocessor programming model]
 
(ARM9 has 7 working modes, corresponding to 7 different register combinations (combinations of 37 internal registers))
 
[Organization of registers in ARM state]
 
1) General registers
 
(31 32-bit general purpose registers and 6 status registers (similar to a microcontroller))
 
[ARM microprocessor programming model]
 
R0-R12 are general registers for storing data or addresses and are not used for special purposes by the system or structure;
(R0-R7 are ungrouped registers: they can be used in any processor mode;
   R8-R12 are grouped registers: depending on the current processor mode;)
(R8-R12: There are two grouped physical registers, providing a register dedicated to FIQ mode, which can speed up FIQ processing)
R13: Stack pointer (SP); there is no special R13 instruction in the ARM instruction set; there is an R13 instruction in Thumb
R14: Link register (LR), which has two special functions in structure (1. R14 of the mode itself is used to save the subroutine return address, 2. When an exception occurs, it is used to save the exception return address) [page]
 
2) Program Status Register (CPSR)
 
[ARM microprocessor programming model]
 
mode: indicates the working status of the processor
·T: 0, ARM state; 1, Thumb state;
Interrupt disable bits
I=1:Disables the IRQ
F=1: Disable the FIO
·condition code flags
N = Negative result from ALU (non-zero)
Z = Zero result from ALU
C = ALU operation Carried out
V = ALU operation  Overflowed
 
v5, v6
Q: dsp extension unit
J: Java accelerator
 
(There are two ways for the processor to store data, big endian and little endian
Big endian: high byte in low order, low byte in high order
Little endian: high byte in high order, low byte in low order
*Old versions only support little-byte order, but now all versions are supported, and Linux network programming uses big-byte order)
 
[Exceptions supported by ARM]
(The processor will enter exception mode whenever the normal program flow is temporarily suspended. Before handling the exception, the ARM9 core saves the current processor state (CPSR->SPSR) so that when the processor ends it can resume execution of the original program (SPSR->CPSR))
 
[ARM microprocessor programming model]
Reset: reset interrupt;
Undefineed Instruction: Undefined instruction;
Software Interrupt: Software interrupt
Prefetch Abort: Prefetch instruction abort;
Date Abort: Data abort;
IRQ: external interrupt;
FIQ: Fast Interrupt Request;
 
Abnormal response
 
1) Entering exception:
*LR stores the address of the next instruction after the currently executed instruction: LR=PC-4
*CPSR->SPSR (retain status)
*CPSR->status corresponding to the exception type
* PC is fetched from the associated exception vector
* Jump, execute command 
 
[ARM microprocessor programming model]
2) Return from an exception
*SPSR->CPSR
*The LR register value minus an offset is copied to the PC register and the interrupted user program is jumped
 
[ARM microprocessor programming model]


(Here, we can think about it in detail in combination with the 3-stage pipeline processing structure of ARM7, but why not save PC-8 in R14 in the first step?)
Keywords:ARM Reference address:ARM Microprocessor Programming Model

Previous article:AVR reads keyboard using IF statement
Next article:MEGA16 game development board driver

Recommended ReadingLatest update time:2024-11-17 06:57

Research and Application of Image Data Acquisition System Based on ARM7
Image data acquisition systems are widely used in defense, industry, medicine, household and scientific research. The image sensors used in these systems are mainly CCD and CMOS arrays. Among them, CMOS has the characteristics of high integration, simple voltage supply circuit, low cost and low technical level compa
[Microcontroller]
Research and Application of Image Data Acquisition System Based on ARM7
2.3 [Bare Metal Part] Mastering the ARM Chip Clock System
1. Clock Architecture CPU-FCLK:400MHZ AHB bus-HCLK: 136MHZ APB bus-PCLK: 68MHZ Documentation explanation: Chinese translation: FCLK, HCLK and PCLK, FCLK is used by ARM920T. HCLK is used for AHB bus, which is used by ARM920T, memory controller, interrupt controller, LCD controller, DMA and USB host block. PCLK
[Microcontroller]
2.3 [Bare Metal Part] Mastering the ARM Chip Clock System
Embedded Linux Code Transplantation Based on ARM9
0 Introduction With the rapid development of computer technology, communication technology and the Internet, embedded systems have been increasingly widely used. At the same time, the complexity of embedded systems is also increasing, and embedded operating systems have become the most important component. At pr
[Microcontroller]
Embedded Linux Code Transplantation Based on ARM9
Multi-sensor data fusion fire alarm system based on ARM9
In view of the fact that a single ordinary type of fire detection alarm can no longer meet the demand, the use of multiple sensors to comprehensively collect various abnormal information before a fire occurs, and the use of multi-sensor information fusion technology to process the fire information provided by the se
[Microcontroller]
ARM's seven working modes
1. 7 working modes of ARM processor (privileged mode, privileged mode, exception mode) User mode (USR): Normal program execution mode, cannot be switched directly to other modes System mode (SYS): Privileged tasks running the operating system, similar to user mode, but with privileges such as being able to switch di
[Microcontroller]
ARM's seven working modes
ARM reads DS1302 assembly program
GPACON             EQU            0x56000000 GPADAT             EQU            0x56000004 GPAUP              EQU            0x56000008                         EXPORT xmain                         AREA    Init,CODE,READONLY                         ENTRY xmain                         ldr r0,=GPACON                    
[Microcontroller]
Professional engineers explain the difference between ARM and MCU
1. Software: This is probably the biggest difference. The operating system was introduced. Why was the operating system introduced? What are the benefits? 1) Convenience. This is mainly reflected in the later development, that is, developing applications directly on the operating system. Unlike a single-chip microco
[Microcontroller]
Learn ARM development (2)
It was Sunday, and I was just resting at home. It was a good time to learn ARM. I got up very early in the morning because I was always anxious about how to set up the ARM development environment. I couldn't sleep well. I immediately turned on the computer. In order to speed up, I turned on both computers at hom
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号