S3C2440 Architecture

Publisher:平和梦想Latest update time:2018-06-04 Source: eefocusKeywords:S3C2440 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This article is a study of the ARM processor architecture, targeting the S3C2440 model. It refers to the content of the PROGRAMMER'S MODEL section in Samsung's official technical document S3C2440.pdf.

ARM and THUMB instruction modes

S3C2440 uses armv4t instruction set, and supports both arm instruction set and thumb instruction set. Arm instruction is 32-bit, while thumb instruction is 16-bit. The reason for thumb instruction is to reduce the storage space of code.

Switching between two instruction sets

  • Manual switching 
    is because no matter whether it is the arm instruction set or the thumb instruction set, the lowest bit of the code address is redundant, because thumb is 16-bit aligned and arm is 32-bit aligned. So the last bit can be used as a reference for switching. When executing the BX instruction, if the last bit of the address is set, the following instructions are interpreted using the thumb instruction set. When jumping, the last bit is cleared and the arm instruction set is used.

  • Automatic switching 
    can only use the arm instruction set in privileged mode, so when executing thumb instructions in user mode, if you jump to privileged mode, it will automatically switch to the arm instruction mode. When switching back to user mode from privileged mode, if the thumb instruction set was used before entering, it will automatically switch back to the thumb instruction set.

Data storage format 
S3C2440 supports both big-endian and small-endian data storage formats. By default, the little-endian format is used for storage.

  • Big-endian storage 
    stores high bytes in low addresses and low bytes in high addresses.

  • Little endian storage 
    high bytes are stored in high addresses and low bytes are stored in low addresses.

Operation Mode

ARM920T supports seven operation modes:

  • User Mode

  • Fast interrupt mode

  • Interrupt Mode

  • Manager Mode

  • Abort Mode

  • System Mode

  • Undefined mode

Mode switching can be done by software or automatically, such as when an interrupt occurs. Except for user mode, all other modes are privileged modes, and some resources can only be used in privileged mode.

register

The ARM920T has a total of 37 registers, and not all registers are visible at the same time.

Registers in ARM mode

Registers in ARM mode

Registers in thumb mode

In thumb mode, not all registers are used, and registers R8-R12 are not used.

Registers in thumb mode

Although the R8-R12 registers cannot be used in thumb mode, the compiler can use these registers as fast storage.

Status Register

CPSR and SPSR are two status registers in ARM920T. SPSR is used to temporarily save the value of the CPSR register.

Function of the status register

  • Save the most recent ALU calculation information

  • Controlling interrupts on and off

  • Set the processor mode

Status Register

Exception handling

In ARM, all events that interrupt the normal execution of the program are called exceptions, and interrupts are also exceptions. When entering an exception, the hardware will automatically perform the following operations; but when exiting an exception, the following operations are implemented by our own software.

Entering an exception

1. Save the next instruction address in the appropriate LR register (whichever exception occurs will be saved in the LR register in that mode).

2. Copy the CPSR to the appropriate SPSR (whichever exception occurs will be saved in the SPSR register in that mode).

3. Set the mode bit in CPSR

4. PC gets the address from the corresponding interrupt vector table

Exit abnormally

1. Subtract an offset from the value in LR and assign it to PC

2. Copy the value of SPSR to CPSR

3. If the interrupt prohibition flag is set upon entry, clear the prohibition flag

for example:

HandleIRQ:
    sub lr, lr, #4 @ Calculate the return address
    stmdb sp!, { r0-r12,lr } @ Save the used registers
                                    @ Note that the sp at this time is the sp in interrupt mode
                                    @ The initial value is 3072 set above

    ldr lr, =int_return @ Set the return address after calling ISR, namely EINT_Handle function  
    ldr pc, =EINT_Handle @ Call interrupt service function, int_return in interrupt.c:
    ldmia sp!, { r0-r12,pc }^ @ interrupt return, ^ means copy the value of spsr to cpsr12345678910

The interrupt pending bit needs to be cleared in the interrupt handling function EINT_Handle.

The following table shows the return functions that need to be executed when exiting various exceptions:

Abnormal exit execution code

Interrupt vector table address

The following table shows the addresses of the interrupt vector table. These addresses are specified and cannot be changed by yourself.

Interrupt vector table

Exception Priority

When multiple exceptions occur simultaneously, there is a fixed priority to determine which one is executed first.

high priority

1. Reset
2. Data abort 
3. FIQ
4. IRQ
5. Prefetch abort123456

Low Priority

6. Undefined Instruction, Software interrupt


Keywords:S3C2440 Reference address:S3C2440 Architecture

Previous article:Samsung CPU s3c2440 interrupt vector table problem
Next article:Analysis of s3c2440 startup process

Recommended ReadingLatest update time:2024-11-16 15:28

S3C2440_LCD Controller
1. The LCD controller has two main functions: 1) Get the data of a certain pixel from the framebuffer; 2) Combined with other signals, this data is sent to the LCD Whether it is 2440 or other types of ARM chips, the functions of their LCD controllers are the same, but the operation of the memory is sl
[Microcontroller]
S3C2440_LCD Controller
《Linux driver: s3c2440 lcd driver analysis》
I. Introduction The content of s3c2440 lcd driver analysis includes the principle of LCD image display, the operation of s3c2440 LCD controller, the example of LCD driver using platform bus-device-driver model, the setting of LCD related parameters, fb character device driver example, framebuffer registration a
[Microcontroller]
IIS of s3c2440 (3) I2S bus protocol
I2S Bus Protocol   1. Overview of I2S Bus The acquisition, processing and transmission of audio data are important components of multimedia technology. Many digital audio systems have entered the consumer market, such as digital audio tapes and digital sound processors. For equipment and manufacturers, standardized in
[Microcontroller]
S3C2440 bare metal --- touch screen calibration and line drawing programming
1. Calibration procedure framework
[Microcontroller]
S3C2440 bare metal --- touch screen calibration and line drawing programming
S3C2440 serial port code_function_initialization_send Byte_send string_Printf
Usually the serial port initialization statement is written into an initialization function Uart_Init():  1 void Uart_Init(int baud)  2 {  3     int i;  4     rUFCON0 = 0x0;   //UART FIFO disable  5 rULCON0 = 0x3; //Turn off infrared transmission mode and use Normal mode, No parity, 1 stop, 8 bits of data per frame
[Microcontroller]
Introduction to the process of porting MiniGUI to S3C2440
    With the rapid development of embedded systems, the demand for graphical user interfaces (GUI) is becoming more and more obvious. MiniGUI is a lightweight graphical  user interface support system for real-time embedded systems. It is widely used in communications, medical treatment, industrial control, electronics
[Microcontroller]
Introduction to the process of porting MiniGUI to S3C2440
S3C2440 external key interrupt analysis
While learning how to make a bootloader, I learned about the experiment of "controlling the LED on and off by pressing an interrupt key". The development board I used was different from the one in the video explanation, so I thought about the various registers involved in the interrupt and tried coding. Finally, I com
[Microcontroller]
S3C2440 external key interrupt analysis
Detailed explanation of S3C2440 external interrupt
    To correctly execute the external interrupt of 2440, generally two parts need to be completed: interrupt initialization and interrupt handling function.     Before executing the interrupt, you need to initialize the interrupt to be used. The external interrupt pin EINT of 2440 is multiplexed with the general IO pi
[Microcontroller]
Detailed explanation of S3C2440 external interrupt
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号