zoukankan      html  css  js  c++  java
  • 核心初始化程序

    1.start.S

    .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
        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:
        bl set_svc
        bl disable_watchdog
        bl disable_interrupt
        bl disable_mmu
    
    set_svc:
        mrs r0,cpsr
        bic r0,r0,#0x1f
        orr r0,r0,#0xd3
        msr cpsr,r0
        mov pc,lr
    
    #define pWACON    0x7e004000
    disable_watchdog:
        ldr r0,=pWACON
        mov r1,#0x0
        str r1,[r0]
        mov pc,lr
    
    disable_interrupt:
        mvn r1,#0x0
        ldr r0,=0x71200014
        str r1,[r0]
    
        ldr r0,=0x71300014
        str r1,[r0]
    
        mov pc,lr
    
    disable_mmu:
        mcr p15,0,r0,c7,c7,0
        
        mrc p15,0,r0,c1,c0,0
        bic r0,r0,#0x00000005
        mcr p15,0,r0,c1,c0,0
    
        mov pc,lr

    2.xboot.lds

    OUTPUT_ARCH(arm)
    ENTRY(_start)
    SECTIONS
    {
        . = 0X5000000;
    
        . = ALIGN(4);
        .text :
        {
            start.o(.text)
            *(.text)
        }
    
        . = ALIGN(4);
        .data :
        {
            *(.data)
        }
    
        . = ALIGN(4);
        bss_start = .;
        .bss :
        {
            *(.bss)
        }
        bss_end = .;
    }

    3.Makefile

    all : start.o
        arm-linux-ld -Txboot.lds -o xboot.elf $^
        arm-linux-objcopy -O binary xboot.elf xboot.bin
    
    %.o : %.c
        arm-linux-gcc -g -c $^
    
    %.o : %.S
        arm-linux-gcc -g -c $^
    
    .PHONY : clean
    clean:
            rm *.o *.bin *.elf
  • 相关阅读:
    20年美亚杯WRITE UP
    博客搬迁
    前端工程化1-模块
    移动端(h5)工具函数--视口适配(viewport)
    Understanding ES6 Modules(译)
    手写http请求并发、重试、超时函数
    两道编程题引发的思考
    前端基础走查(六):异步任务和事件循环
    vue 本地图片批量下载以及压缩成zip文件下载
    mybatis generator逆向工程
  • 原文地址:https://www.cnblogs.com/boyiliushui/p/5766171.html
Copyright © 2011-2022 走看看