ecos vector.S 分析I: 主干部分

本文主要分析了ECOS中的vector.S文件,探讨其在处理exception和interrupt时的主干部分,涉及MIPS指令系统。文章中还包含了读者的讨论,包括对不同指令系统的提问。
摘要由CSDN通过智能技术生成
##-----------------------------------------------------------------------------
## Hardware supplied vectors
   
    .set    noreorder

    .section ".reset_vector","ax"

    # Reset vector at 0xBFC00000
>>cpu从这里开始执行
FUNC_START(reset_vector)

>>cpu vendor 添加一些初始化,比如一些clock,reset;
>>在CYG_HAL_STARTUP_RAM不需要,因为在_ROMRAM,_ROM才需要

#ifndef CYG_HAL_STARTUP_RAM
#  if defined(CYGPKG_HAL_RESET_VECTOR_FIRST_CODE)
    hal_reset_vector_first_code
#  endif
#  if defined(CYGPKG_HAL_EARLY_INIT)
    hal_early_init
#  endif
    # Decide whether this is an NMI, cold or warm boot.
>>这里英文注释已经很清楚了
    mfc0    k0,status        # get status reg
    lui    k1,0x0008        # isolate NMI bit
    and    k1,k1,k0       
    beqz    k1,1f            # skip if zero
    nop

    lar    k1,__nmi_entry        # jump to ROM nmi code
    jalr    k1
    nop
1:
    lui    k1,0x0010        # isolate soft reset bit
    and    k1,k1,k0       
    beqz    k1,2f            # skip if zero
    nop

    lar    k1,__warm_start        # jump to ROM warm_start code
    jr    k1
    nop
2:
    la    k0,INITIAL_CONFIG0    # Set up config0 register
    mtc0    k0,config0        # to disable cache
#endif   
    lar    v0,_start        # jump to start
#ifdef CYGARC_START_FUNC_UNCACHED
    CYGARC_ADDRESS_REG_UNCACHED(v0)
#endif

    jr    v0
    nop                # (delay slot)

FUNC_END(reset_vector)
   
>>这里几个*_vector是mips exception 的入口,详细的去看mips的书籍
>>值得提出的是,这几个位置会被前面的code比如hal_reset_vector_first_code
>>挤出正确的位置,不过后面还会有些code会把这些*_vector复制到ram里的相应的位置
>>只要保证在code切换到ram exception mode之前,不要产生任何exception就可以了
    .section ".debug_vector","ax"
       
    # Debug vector at 0xBFC00200
   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值