20. Core initialization of the anomaly vector table

Source: Internet
Author: User

20. Core initialization of the anomaly vector table

First, the exception vector table:

Contains: 1. Exception definitions

???? 2. Exception types

???? 3. Abnormal entrance

???? 4. Vector table

First exception definition, 2.6.Exceptions exception for 2.Programmers ' model in arm Architecture Reference manual.pdf Document:

Exception: Because of internal or external events that cause the processor to stop working on the work that is being processed, instead of dealing with these occurrences.

2. Exception types

When an exception occurs, the ARM processor jumps to the fixed address that should be abnormal to execute the exception handler, and this fixed address is called the anomaly vector, and multiple exception vectors form an anomaly vector table.

From the above exception vector address can be noted that the address 0x00000014 is not used. To the right you can see that there are two sets of exception vector tables to use. A group is a low address, and a group is a high address. Can be configured by CP15 the corresponding bit, when the CP15 is not configured, the default is from the low address as the exception vector table.

3. Entrance: 00000000;

?

4. Anomaly Vector table: a table consisting of seven exception vectors and processing function jump relationships is the exception vector table.

?

?

Ii. Code Preparation (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 =.;

}

assembly file start. s to complete the code structure for 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???????????????? //Pay attention to 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

The makefile file for this project is written after it has been written:

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

Once written, the engineering framework is set up, and make is compiled:

You can see that the bin file was successfully generated, stating that the bare metal Uboot project was established.

?

?

?

?

?

?

?

?

20. Core initialization of the anomaly vector table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.