20.Core initialization exception vector table

Publisher:美丽的1号Latest update time:2024-10-30 Source: cnblogs Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Exception vector table:

Contains: 1. Exception definition

2. Exception Type

3. Abnormal entrance

4. Vector table

First, the exception definition is in the ARM Architecture Reference Manual.pdf document, 2.6.Exceptions of 2.Programmers' Model:

Exception: Due to some internal or external events, the processor stops the work it is doing and turns to handle these events.

2. Exception Type

When an exception occurs, the ARM processor will jump to the fixed address corresponding to the exception to execute the exception handler. This fixed address is called an exception vector. Multiple exception vectors together form an exception vector table.

From the exception vector address above, you can notice that address 0x00000014 is not used. On the right side of the above figure, you can see that there are two sets of exception vector tables available. One set is for low addresses, and the other set is for high addresses. They can be configured through the corresponding bits of CP15. When CP15 is not configured, the default is to use the low address as the exception vector table.

3.Entrance: 00000000;

4. Exception vector table: The table consisting of seven exception vectors and processing function jump relationships is the exception vector table.

2. Code Writing (6410)

Linker script: forfish.lds:

OUTPUT_ARCH(arm)

ENTRY(_start)

SECTIONS {

. = 0x50008000;

. = ALIGN(4);

.text :

{

start.o (.text)

*(.text)

}

. = ALIGN(4);

.data :

{

*(.data)

}

. = ALIGN(4);

bss_start = .;

.bss :

{

*(.bss)

}

bss_end = .;

}

The assembly file start.S completes the code structure of the corresponding hardware operation:

@****************************

@File:start.S

@

@FORFISH

@****************************

.text

.global _start

_start:

b reset

ldr pc, _undefined_instruction

ldr pc, _software_interrupt

ldr pc, _prefetch_abort

ldr pc, _data_abort

ldr pc, _not_used //Note this unused address

ldr pc, _irq

ldr pc, _fiq

_undefined_instruction: .word undefined_instruction

_software_interrupt: .word software_interrupt

_prefetch_abort: .word prefetch_abort

_data_abort: .word data_abort

_not_used: .word not_used

_irq: .word irq

_fiq: .word fiq

undefined_instruction:

nop

software_interrupt:

nop

prefetch_abort:

nop

data_abort:

nop

not_used:

nop

irq:

nop

fiq:

nop

reset:

nop

After writing the above, it is time to write the Makefile file for this project:

Makefile:

all: start.o

arm-linux-ld -Tforfish.lds -o forfish.elf $^

arm-linux-objcopy -O binary forfish.elf forfish.bin

%.o : %.S

arm-linux-gcc -g -c $^

.PHONY: clean

clean:

rm *.o *.elf *.bin

After writing, the framework of the project is established, and make is used to compile:

You can see that the bin file is successfully generated, indicating that the bare metal uboot project has been established.


Reference address:20.Core initialization exception vector table

Previous article:21.Core initialization svc mode
Next article:19.Bootloader framework design

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号