ecos vector.S 分析I: 主干部分
来源:互联网 发布:如何解决软件危机 编辑:程序博客网 时间:2024/06/06 02:42
##-----------------------------------------------------------------------------
## 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
FUNC_START(debug_vector)
la k0,32*4
la k1,hal_vsr_table # Get VSR table
lw k1,32*4(k1) # load debug vector
jr k1 # go there
nop # (delay slot)
FUNC_END(debug_vector)
.section ".other_vector","ax"
# Common vector at 0x80000080 or 0xBFC00180
FUNC_START(other_vector)
mfc0 k0,cause # K0 = exception cause
nop
andi k0,k0,0x7F # isolate exception code
la k1,hal_vsr_table # address of VSR table
add k1,k1,k0 # offset of VSR entry
lw k1,0(k1) # k1 = pointer to VSR
jr k1 # go there
nop # (delay slot)
FUNC_END(other_vector)
.section ".utlb_vector","ax"
FUNC_START(utlb_vector)
mfc0 k0,cause # K0 = exception cause
nop
andi k0,k0,0x7F # isolate exception code
la k1,hal_vsr_table # address of VSR table
add k1,k1,k0 # offset of VSR entry
lw k1,0(k1) # k1 = pointer to VSR
jr k1 # go there
nop # (delay slot)
FUNC_END(utlb_vector)
##-----------------------------------------------------------------------------
## Startup code
.text
FUNC_START(_start)
# Initialize hardware
>>cpu core 初始化
hal_cpu_init
hal_diag_init
hal_mmu_init
hal_fpu_init
>>如果是_ROMRAM类型,在hal_memc_init里会把text段复制到ram
hal_memc_init
hal_intc_init
hal_cache_init
hal_timer_init
#if 0
## Spin to allow ejtag gdb to attach
1:
li t0, 1
bnez t0, 1b
nop
#endif
#ifdef CYG_HAL_STARTUP_RAM
hal_serial_init
#endif
#ifdef CYGARC_START_FUNC_UNCACHED
# switch to cached execution address if necessary
# assumption is that hal_cache_init makes this safe
lar v0,1f
jr v0
nop
1:
#endif
# Load Global Pointer register.
la gp,_gp
# load initial stack pointer
la a0,__interrupt_stack
move sp,a0
>>填充hal_vsr_table里面的内容
hal_mon_init
#ifdef CYG_HAL_STARTUP_ROM
# Copy data from ROM to RAM
>>复制data段
.extern hal_copy_data
jal hal_copy_data
nop
#endif
# Zero BSS
>>清除bss段
.extern hal_zero_bss
jal hal_zero_bss
nop
# Call variant and platform HAL
# initialization routines.
.extern hal_variant_init
jal hal_variant_init
nop
>>平台上的初始化,比如GPIO
.extern hal_platform_init
jal hal_platform_init
nop
>>调用c++ 类的初始化函数
# Call constructors
.extern cyg_hal_invoke_constructors
jal cyg_hal_invoke_constructors
nop
#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS)
.extern initialize_stub
jal initialize_stub
nop
#endif
#if defined(CYGDBG_HAL_MIPS_DEBUG_GDB_CTRLC_SUPPORT)
.extern hal_ctrlc_isr_init
jal hal_ctrlc_isr_init
nop
#endif
# Call cyg_start
>>进入主程序
.extern cyg_start
j cyg_start
lui ra,0
FUNC_END(_start )
## 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
FUNC_START(debug_vector)
la k0,32*4
la k1,hal_vsr_table # Get VSR table
lw k1,32*4(k1) # load debug vector
jr k1 # go there
nop # (delay slot)
FUNC_END(debug_vector)
.section ".other_vector","ax"
# Common vector at 0x80000080 or 0xBFC00180
FUNC_START(other_vector)
mfc0 k0,cause # K0 = exception cause
nop
andi k0,k0,0x7F # isolate exception code
la k1,hal_vsr_table # address of VSR table
add k1,k1,k0 # offset of VSR entry
lw k1,0(k1) # k1 = pointer to VSR
jr k1 # go there
nop # (delay slot)
FUNC_END(other_vector)
.section ".utlb_vector","ax"
FUNC_START(utlb_vector)
mfc0 k0,cause # K0 = exception cause
nop
andi k0,k0,0x7F # isolate exception code
la k1,hal_vsr_table # address of VSR table
add k1,k1,k0 # offset of VSR entry
lw k1,0(k1) # k1 = pointer to VSR
jr k1 # go there
nop # (delay slot)
FUNC_END(utlb_vector)
##-----------------------------------------------------------------------------
## Startup code
.text
FUNC_START(_start)
# Initialize hardware
>>cpu core 初始化
hal_cpu_init
hal_diag_init
hal_mmu_init
hal_fpu_init
>>如果是_ROMRAM类型,在hal_memc_init里会把text段复制到ram
hal_memc_init
hal_intc_init
hal_cache_init
hal_timer_init
#if 0
## Spin to allow ejtag gdb to attach
1:
li t0, 1
bnez t0, 1b
nop
#endif
#ifdef CYG_HAL_STARTUP_RAM
hal_serial_init
#endif
#ifdef CYGARC_START_FUNC_UNCACHED
# switch to cached execution address if necessary
# assumption is that hal_cache_init makes this safe
lar v0,1f
jr v0
nop
1:
#endif
# Load Global Pointer register.
la gp,_gp
# load initial stack pointer
la a0,__interrupt_stack
move sp,a0
>>填充hal_vsr_table里面的内容
hal_mon_init
#ifdef CYG_HAL_STARTUP_ROM
# Copy data from ROM to RAM
>>复制data段
.extern hal_copy_data
jal hal_copy_data
nop
#endif
# Zero BSS
>>清除bss段
.extern hal_zero_bss
jal hal_zero_bss
nop
# Call variant and platform HAL
# initialization routines.
.extern hal_variant_init
jal hal_variant_init
nop
>>平台上的初始化,比如GPIO
.extern hal_platform_init
jal hal_platform_init
nop
>>调用c++ 类的初始化函数
# Call constructors
.extern cyg_hal_invoke_constructors
jal cyg_hal_invoke_constructors
nop
#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS)
.extern initialize_stub
jal initialize_stub
nop
#endif
#if defined(CYGDBG_HAL_MIPS_DEBUG_GDB_CTRLC_SUPPORT)
.extern hal_ctrlc_isr_init
jal hal_ctrlc_isr_init
nop
#endif
# Call cyg_start
>>进入主程序
.extern cyg_start
j cyg_start
lui ra,0
FUNC_END(_start )
0
上一篇:vi退出时屏幕会遗留信息
下一篇:ecos vector.S 分析II: exception/interrupt
相关热门文章
- A sample .exrc file for vi e...
- IBM System p5 服务器 HACMP ...
- 游标的特征
- DB2 9 应用开发(733 考试)认...
- busybox的httpd使用CGI脚本(Bu...
给主人留下些什么吧!~~
stackpointer2012-05-24 15:04:03
显然是mips指令系统
回复 | 举报
chinaunix网友2008-09-03 13:38:11
Atheros AP3X - AP5X
回复 | 举报
chinaunix网友2007-08-16 13:54:09
请问你的vector.s代码是基于什么指令系统的?
回复 | 举报
评论热议
阅读全文
0 0
- ecos vector.S 分析I: 主干部分
- ecos vector.S 分析I: 主干部分
- ecos vector.S 分析II: exception/interrupt
- ecos vector.S 分析II: exception/interrupt
- x264源代码简单分析:编码器主干部分-1
- x264源代码简单分析:编码器主干部分-2
- FFmpeg的HEVC解码器源代码简单分析:解码器主干部分
- x264源代码简单分析:编码器主干部分-1
- x264源代码简单分析:编码器主干部分-2
- FFmpeg的H.264解码器源代码简单分析:解码器主干部分
- ecos kernel 分析
- ECOS中断机制分析
- ecos代码分析(1)
- ecos代码分析(2)
- ecos代码分析(3)
- ecos代码分析(4)
- ecos kernel 分析
- ecos kernel 分析
- 第二周【项目2
- 1027. Colors in Mars (20)
- 远程桌面连接的利器-mRemote介绍
- IDEA17配置SpringMVC及HelloWorld例子
- 34.Java基础语法
- ecos vector.S 分析I: 主干部分
- div中文字超长的换行神器:word-break:break-all;
- Centos下编译安装fileinfo扩展
- Kotlin 第十二章:泛型
- opencv录制视频并保存视频
- ecos kernel 分析
- css 多行隐藏
- 1031. Hello World for U (20)
- 索引超出了数组界限(Microsoft.SqlServer.Smo) SSMS连接远程SQL Server服务器是很方便的。 昨天我用SQL Server 2008 SSMS连接SQL Server
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
初三物理一对一
什么的初三作文
怎么在初三提高成绩
初三学生不想上学怎么办
儿子初三成绩不好
初三学习计划600字
初三出国留学
初三数学重点知识
初三物理电路图
初三所有化学实验
初三语文配套答案
初三物理实验器材
高中物理补课
初二下册数学
初二物理下册知识点
初中女生
高一英语学习
小升初语文试卷
初中二年级数学
谈诚信议论文初三
怎样提高成绩初三
谈诚信议论文600字初三
谈诚信作文600字初三
国产初中
初中女真紧
初中数学
初中英语
初中物理
初中试题网
初中试卷网
初中试题
初中试卷
初中记叙文
初中图片
初中数学题
初中三年
初中 英语
初中女
初中的英语
初中英文
初中知识