【Xilinx】SynchronousInterruptHandler错误排查笔记

一、ArmV8的异常处理

在基于A53的MPSOC系列上,相比zynq系列原有的中断向量处理方式做了大幅度修改

ARMv8-A系列定义了一系列的异常等级,从EL0到EL3。随着n的增加,软件的执行权限也相应的增加;

EL0被称为无特权执行;
EL2提供了对虚拟化的支持
EL3提供了安全状态切换功能(安全状态与非安装状态之间的切换)

注意,EL0和EL1是必须实现的,EL2和EL3是可选的。而且一个PE中实现的EL可以不连续,例如只实现了EL0、EL1和EL3。

在这里插入图片描述

二、64位lscript.ld的修改

左边是32位的lscript.ld,右边是64位的lscript.ld,主要的差异部分如下图
在这里插入图片描述
在这里插入图片描述

三、asm_vectors.S的修改

在项目文件夹下搜索到asm_vectors.S
例如psu_cortexa53_0\standalone_psu_cortexa53_0\bsp\psu_cortexa53_0\libsrc\standalone_v7_3\src\asm_vectors.S,根据项目版本不同,路径可能有差异,仅供参考

可以看到中断向量表,对应表中的4个地址
在这里插入图片描述

EL0的Synchronous offset是0x0。其他EL级别,Synchronous offset是0x200,IRQ or vIRQ offset是0x280, FIQ or vFIQ offset是0x300,SError or vSError offset是0x380,
MPSoC A53启动后,在EL0,执行的第一条代码是“b _boot”。

	b	_boot
.org (VBAR + 0x200)
	b	SynchronousInterruptHandler

.org (VBAR + 0x280)
	b	IRQInterruptHandler

.org (VBAR + 0x300)
	b	FIQInterruptHandler

.org (VBAR + 0x380)
	b	SErrorInterruptHandler

四、SynchronousInterruptHandler函数解析

以下是SynchronousInterruptHandler函数的内容
它会判断ESR_EL3的取bit26-bit31,6个bit,判断是不是000111,如果不是则跳转到死循环

SynchronousInterruptHandler:
	saveregister

/* Check if the Synchronous abort is occurred due to floating point access. */
.if (EL3 == 1)
	mrs	x0, ESR_EL3
.else
	mrs	x0, ESR_EL1
.endif
	and	x0, x0, #(0x3F << 26)
	mov	x1, #(0x7 << 26)
	cmp	x0, x1
/* If exception is not due to floating point access go to synchronous handler */
	bne	synchronoushandler

/*
 * If excpetion occurred due to floating point access, Enable the floating point
 * access i.e. do not trap floating point instruction
 */
 .if (EL3 == 1)
	mrs	x1,CPTR_EL3
	bic	x1, x1, #(0x1<<10)
	msr	CPTR_EL3, x1
.else
	mrs	x1,CPACR_EL1
	orr	x1, x1, #(0x1<<20)
	msr	CPACR_EL1, x1
.endif
	isb

/* If the floating point access was previously enabled, store FPU context
 * registers(storefloat).
 */
	ldr	x0, =FPUStatus
	ldrb	w1,[x0]
	cbnz	w1, storefloat
/*
 * If the floating point access was not enabled previously, save the status of
 * floating point accessibility i.e. enabled and store floating point context
 * array address(FPUContext) to FPUContextBase.
 */
	mov	w1, #0x1
	strb	w1, [x0]
	ldr	x0, =FPUContext
	ldr	x1, =FPUContextBase
	str	x0,[x1]
	b	restorecontext
storefloat:
	savefloatregister
	b	restorecontext
synchronoushandler:
	bl	SynchronousInterrupt
restorecontext:
	restoreregister
	eret

五、ESR_EL3的错误代码解释

EC, bits [31:26]
Exception Class. Indicates the reason for the exception that this register holds information about.

For each EC value, the table references a subsection that gives information about:

The cause of the exception, for example the configuration required to enable the trap.
The encoding of the associated ISS.
Possible values of the EC field are:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 21
    评论
小梅哥在学习Xilinx FPGA期间进行了积极的探索,特别是对Cyclone V SOC的开发流程进行了学习。从裸机到基于Linux嵌入式系统,小梅哥实现了FPGA和ARM Cortex-A9 CPU之间的双向控制和数据传输。 在代码编写方面,小梅哥设计了一个名为mux2的模块,用于实现二选一多路器。模块包含了输入和输出端口,并通过assign语句实现了信号的赋值。 在激励文件中,小梅哥使用reg和wire定义了输入和输出信号,并通过mux2模块进行了实例化。然后,通过initial块生成了一系列的激励信号,对模块进行仿真。 总结来说,小梅哥在Xilinx FPGA学习笔记中记录了自己对Cyclone V SOC的学习、代码编写和激励文件的使用。这些学习内容对于理解FPGA开发流程以及实现特定功能非常有帮助。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [FPGA自学笔记——设计与验证VIP版.pdf](https://download.csdn.net/download/qq_30307853/11656682)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [小梅哥Xilinx FPGA学习笔记1——二选一多路器](https://blog.csdn.net/weixin_42454243/article/details/122026484)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值