打印

引导程序求助

[复制链接]
1730|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
lingwendu|  楼主 | 2009-10-21 20:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
AREA    Init,CODE,READONLY

    ENTRY

    ;1)The code, which converts to Big-endian, should be in little endian code.
    ;2)The following little endian code will be compiled in Big-Endian mode.
    ;  The code byte order should be changed as the memory bus width.
    ;3)The pseudo instruction,DCD can't be used here because the linker generates error.
    ASSERT    :DEF:ENDIAN_CHANGE
    [ ENDIAN_CHANGE
        ASSERT  :DEF:ENTRY_BUS_WIDTH
        [ ENTRY_BUS_WIDTH=32
        b    ChangeBigEndian        ;DCD 0xea000007
        ]

        [ ENTRY_BUS_WIDTH=16
        andeq    r14,r7,r0,lsl #20   ;DCD 0x0007ea00
        ]

        [ ENTRY_BUS_WIDTH=8
        streq    r0,[r0,-r10,ror #1] ;DCD 0x070000ea
        ]
    |
        b    ResetHandler
    ]
    b    HandlerUndef    ;handler for Undefined mode
    b    HandlerSWI    ;handler for SWI interrupt
    b    HandlerPabort    ;handler for PAbort
    b    HandlerDabort    ;handler for DAbort
    b    .        ;reserved
    b    HandlerIRQ    ;handler for IRQ interrupt
    b    HandlerFIQ    ;handler for FIQ interrupt

;@0x20
    b    EnterPWDN    ; Must be @0x20.

我的问题:编译之后0x00000000处一定放的是b ResetHandler吗?他前面还有几条指令,如果满足条件也会编译,不就把0x00000000处给占了吗?想不通,望赐教!

相关帖子

沙发
阿南| | 2009-10-22 10:17 | 只看该作者
一定是.如果不是,那么复位之后就找不到程序执行入口而跑飞

使用特权

评论回复
板凳
triumphr| | 2009-10-23 12:48 | 只看该作者
恩恩……

使用特权

评论回复
地板
gooogleman| | 2009-10-24 14:55 | 只看该作者
这样虽然写法有点怪。

但是手册有说明,中断向量表是必须存放在0x00000000 或者0xffff0000的,在裸奔下一般是0x00000000
wince下是0xffff0000
-----------------------------------------------------
————————下面来看看

2.4 Exceptions, Interrupts, and the Vector Table

When an exception or interrupt occurs, the processor sets the pc to a specific memory
address. The address is within a special address range called the vector table. The entries
in the vector table are instructions that branch to specific routines designed to handle a
particular exception or interrupt.

——当异常或者中断发生的时候,处理器设置PC为一个特殊的内存地址。这个地址叫做中断向量表。中断向量表入口是中断、异常的分支入口((*^__^*) 嘻嘻……,这个翻译的好烂,不过大家知道就可以了)。

The memory map address 0x00000000 is reserved for the vector table, a set of 32-bit
words. On some processors the vector table can be optionally located at a higher address
in memory (starting at the offset 0xffff0000). Operating systems such as Linux and
Microsoft’s embedded products can take advantage of this feature.

——内存映射地址0x00000000 是为中断向量表保留的。在某些处理器中断向量表地址为0xffff0000。某些操作系统如linux可以利用这个特征(其实wince就是采用0xffff0000作为中断向量表的地址,但是令人奇怪的是优龙的ADS bootloader的中断向量表地址是0x00000000 ,估计这是编译器决定了)。

When an exception or interrupt occurs, the processor suspends normal execution and
starts loading instructions fromthe exception vector table (see Table 2.6). Each vector table
entry contains a form of branch instruction pointing to the start of a specific routine:

——当异常或者中断发生的时候,处理器挂起正常执行的程序并开始加载中断向量表,每个中断入口包含一个指向 specific routine(这个不知道怎么翻译)的分支指令。

■ Reset vector is the location of the first instruction executed by the processor when power
is applied. This instruction branches to the initialization code.

——复位向量是打开电源被处理器执行的第一条指令,这条指令branches to初始化代码
■ Undefined instruction vector is used when the processor cannot decode an instruction.

——未定义指令向量,被用在处理器无法解码指令的时候
■ Software interrupt vector is called when you execute a SWI instruction. The SWI
instruction is frequently used as themechanismto invoke an operating systemroutine.

——软件中断向量........软件中断指令常用在操作系统条用。
■ Prefetch abort vector occurs when the processor attempts to fetch an instruction froman
address without the correct access permissions. The actual abort occurs in the decode
stage.

——预取终止向量发生处理器试图取一个指令地址,且没有正确访问许可的时候,实际终止发生在解码阶段
■ Data abort vector is similar to a prefetch abort but is raised when an instruction attempts
to access data memory without the correct access permissions.

——数据终止向量类似预取终止,但是他发生在指令试图访问数据,且内存没有正确访问许可。
■ Interrupt request vector is used by external hardware to interrupt the normal execution
flow of the processor. It can only be raised if IRQs are not masked in the cpsr.

——中断申请向量被用在外部硬件中断正常执行的程序,它只能在IRQs 没有被cpsr屏蔽的情况下。



本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/gooogleman/archive/2008/12/25/3597175.aspx

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

7

主题

39

帖子

1

粉丝