BootLoader (2440) core initialization code

Publisher:学富五车Latest update time:2020-01-11 Source: eefocusKeywords:BootLoader Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1.gboot.lds

OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS {
    . = 0x30008000; //Start address
    
    . = ALIGN(4); //4-byte alignment
    .text : //Code segment
    {
    start.o (.text) //Start execution with .o
    *(.text)
    }

    . = ALIGN(4);
    .data : //Data segment
    {
    *(.data)
    }
    
    . = ALIGN(4);
    bss_start = .; //Define variables
    .bss : //Uninitialized segment
    {
    *(.bss) 
    }
    bss_end = .;
}
2.start.S

.text  
.global _start//define global variable
_start: //code starts executing

//The following is the exception vector table code
    b reset//Reset
    ldr pc, _undifined_instruction
    ldr pc, _software_interrupt
    ldr pc, _prefetch_abort
    ldr pc, _data_abort
    ldr pc, _not_used
    ldr pc, _irq
    ldr pc, _fiq
    
//Define the corresponding variables for jump
_undifined_instruction: .word undifined_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 reset
//The function implemented after the jump
undifined_instruction:
    nop

software_interrupt:
    nop
    
prefetch_abort:
    nop
    
data_abort:
    nop

not_used:
    nop

irq:
    nop

fiq:    
    nop
//reset
reset:
    bl set_svc
    bl disable_watchdog
    bl disable_interrupt
    bl disable_mmu
//set svc mode
set_svc:
    mrs r0, cpsr
    bic r0, r0,#0x1f
    orr r0, r0,#0xd3
    msr cpsr, r0
    mov pc, lr
//disable watchdog
#define pWTCON 0x53000000
disable_watchdog:
    ldr r0, =pWTCON
    mov r1, #0x0
    str r1, [r0]
    mov pc, lr
//disable interrupt
disable_interrupt:
    mvn r1, #0x0
    ldr r0, =0x4a000008
    str r1, [r0]
    mov pc, lr
    //disable mmu
disable_mmu:
    mcr p15,0,r0,c7,c7,0
    mrc p15,0,r0,c1,c0,0
    bic r0, r0, #0x00000007
    mcr p15,0,r0,c1,c0,0
    mov pc, lr

//Makefile3.Makefile 

all: start.o 
    arm-linux-ld -Tgboot.lds -o gboot.elf $^
    arm-linux-objcopy -O binary gboot.elf gboot.bin
    
%.o : %.S
    arm-linux-gcc -g -c $^
    
%.o : %.c
    arm-linux-gcc -g -c $^
    
.PHONY: clean
clean:
    rm *.o *.elf *.bin

/******************************** Stay hungry, Stay foolish. @Rocky ********************************/


Keywords:BootLoader Reference address:BootLoader (2440) core initialization code

Previous article:Assembly to light up the LED lamp (2440)
Next article:ARM-Assembly Instruction Set (Summary)

Recommended ReadingLatest update time:2024-11-15 17:44

Mini2440 starts the file system from NFS
Host shared file system First, the host needs to configure NFS and share the file system Setting kernel parameters The kernel parameters are set as follows: console=ttySAC0 root=/dev/nfs nfsroot=172.20.11.88:/root/linux_kernel/rootfs ip=172.20.11.41:172.20.11.88:172.20.11.1:255.255.255.0:S3C2440A:eth0:off Kernel
[Microcontroller]
Mini2440 starts the file system from NFS
FL2440 development board USB mount
After the kernel and file system are transplanted, USB is transplanted. S3C2440 integrates a USB controller that supports USB 1.1 version, and supports USB host and USB device host compliant with OHCI 1.0 version. The Linux 2.6.29.1 kernel supports the USB controller, and it only needs to be configured in the kernel.
[Microcontroller]
FL2440 development board USB mount
S3C2440 - RTC interrupt
The RTC (Real Time Clock) unit can be powered by the system backup battery when the system is powered off. The RTC can transfer 8-bit BCD data to the CPU through the ARM's STRB/LDRB instructions. The data includes hours, minutes, seconds, hours, days, months and years. The RTC can also perform alarm functions using an
[Microcontroller]
S3C2440 - RTC interrupt
2440 Bare Metal Programming 12 GPS
The Global Positioning System is actually composed of 24 satellites, of which 3 are spare satellites. These satellites are distributed 20,200 kilometers above the earth's surface and belong to 6 orbital planes; the satellite orbital plane is inclined at an angle of 55 degrees, providing global all-weather, once per se
[Microcontroller]
2440 Bare Metal Programming 12 GPS
Detailed analysis of the framework of S3C2440 block device driver
This program’s: By analyzing the block device driver framework under the 2.6 kernel, we know how to write drivers 1. What we have learned before are character device drivers. Let's recall them first. Character device driver: When our application layer reads and writes (read()/write()) character device drivers,
[Microcontroller]
Detailed analysis of the framework of S3C2440 block device driver
Linux-4.9.2 kernel porting on mini2440 (Part 3) - Compilation environment test
3.1 Obtaining the linux-4.9.2 source code Why choose 4.9.2 for porting? Because the Yaffs file system cannot keep up with the new Linux source code, the compilation process will cause a lot of errors and cannot be used, so just choose a relatively new source code. The specific instructions will be discussed when por
[Microcontroller]
Linux-4.9.2 kernel porting on mini2440 (Part 3) - Compilation environment test
Large Parking Lot Management System Solution Based on ZigBee and S3C2440
    How to park quickly in a large parking lot is the biggest problem between managers and parkers. In order to solve this problem that plagues social management, this paper proposes a large parking lot management system solution based on ZigBee and S3C2440. The system uses CC2430 and ultrasonic sensors to collect and
[Microcontroller]
Large Parking Lot Management System Solution Based on ZigBee and S3C2440
S3C2440 Linux LCD Driver Interpretation
s3c2440 linux lcd driver interpretation driver layer, that is, s3c2410fb.c defines platform_driver. For example, the following file defines s3c2410fb_driver: \linux\linux-2.6.29\drivers\video\S3c2410fb.c static struct platform_driver s3c2410fb_driver = {  .probe = s3c2410fb_probe,  .remove  = s3c2410fb_remove, .suspen
[Microcontroller]
Recommended Content
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号