Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46254178
rt-thread
提交
c41bf312
R
rt-thread
项目概览
weixin_46254178
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c41bf312
编写于
3月 21, 2019
作者:
lymzzyh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[libcpu][k210]add stack info printf
上级
78db77f6
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
77 addition
and
2 deletion
+77
-2
libcpu/risc-v/k210/interrupt.c
libcpu/risc-v/k210/interrupt.c
+76
-1
libcpu/risc-v/k210/interrupt_gcc.S
libcpu/risc-v/k210/interrupt_gcc.S
+1
-1
未找到文件。
libcpu/risc-v/k210/interrupt.c
浏览文件 @
c41bf312
...
...
@@ -233,8 +233,82 @@ uintptr_t handle_irq_m_ext(uintptr_t cause, uintptr_t epc)
return
epc
;
}
struct
exception_stack_frame
{
uint64_t
x1
;
uint64_t
x2
;
uint64_t
x3
;
uint64_t
x4
;
uint64_t
x5
;
uint64_t
x6
;
uint64_t
x7
;
uint64_t
x8
;
uint64_t
x9
;
uint64_t
x10
;
uint64_t
x11
;
uint64_t
x12
;
uint64_t
x13
;
uint64_t
x14
;
uint64_t
x15
;
uint64_t
x16
;
uint64_t
x17
;
uint64_t
x18
;
uint64_t
x19
;
uint64_t
x20
;
uint64_t
x21
;
uint64_t
x22
;
uint64_t
x23
;
uint64_t
x24
;
uint64_t
x25
;
uint64_t
x26
;
uint64_t
x27
;
uint64_t
x28
;
uint64_t
x29
;
uint64_t
x30
;
uint64_t
x31
;
};
void
print_stack_frame
(
uintptr_t
*
sp
)
{
struct
exception_stack_frame
*
esf
=
(
struct
exception_stack_frame
*
)
sp
;
rt_kprintf
(
"
\n
=================================================================
\n
"
);
rt_kprintf
(
"x1 (ra : Return address ) ==> 0x%08x%08x
\n
"
,
esf
->
x1
>>
32
,
esf
->
x1
&
UINT32_MAX
);
rt_kprintf
(
"x2 (sp : Stack pointer ) ==> 0x%08x%08x
\n
"
,
esf
->
x2
>>
32
,
esf
->
x2
&
UINT32_MAX
);
rt_kprintf
(
"x3 (gp : Global pointer ) ==> 0x%08x%08x
\n
"
,
esf
->
x3
>>
32
,
esf
->
x3
&
UINT32_MAX
);
rt_kprintf
(
"x4 (tp : Thread pointer ) ==> 0x%08x%08x
\n
"
,
esf
->
x4
>>
32
,
esf
->
x4
&
UINT32_MAX
);
rt_kprintf
(
"x5 (t0 : Temporary ) ==> 0x%08x%08x
\n
"
,
esf
->
x5
>>
32
,
esf
->
x5
&
UINT32_MAX
);
rt_kprintf
(
"x6 (t1 : Temporary ) ==> 0x%08x%08x
\n
"
,
esf
->
x6
>>
32
,
esf
->
x6
&
UINT32_MAX
);
rt_kprintf
(
"x7 (t2 : Temporary ) ==> 0x%08x%08x
\n
"
,
esf
->
x7
>>
32
,
esf
->
x7
&
UINT32_MAX
);
rt_kprintf
(
"x8 (s0/fp: Save register,frame pointer ) ==> 0x%08x%08x
\n
"
,
esf
->
x8
>>
32
,
esf
->
x8
&
UINT32_MAX
);
rt_kprintf
(
"x9 (s1 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x9
>>
32
,
esf
->
x9
&
UINT32_MAX
);
rt_kprintf
(
"x10(a0 : Function argument,return value) ==> 0x%08x%08x
\n
"
,
esf
->
x10
>>
32
,
esf
->
x10
&
UINT32_MAX
);
rt_kprintf
(
"x11(a1 : Function argument,return value) ==> 0x%08x%08x
\n
"
,
esf
->
x11
>>
32
,
esf
->
x11
&
UINT32_MAX
);
rt_kprintf
(
"x12(a2 : Function argument ) ==> 0x%08x%08x
\n
"
,
esf
->
x12
>>
32
,
esf
->
x12
&
UINT32_MAX
);
rt_kprintf
(
"x13(a3 : Function argument ) ==> 0x%08x%08x
\n
"
,
esf
->
x13
>>
32
,
esf
->
x13
&
UINT32_MAX
);
rt_kprintf
(
"x14(a4 : Function argument ) ==> 0x%08x%08x
\n
"
,
esf
->
x14
>>
32
,
esf
->
x14
&
UINT32_MAX
);
rt_kprintf
(
"x15(a5 : Function argument ) ==> 0x%08x%08x
\n
"
,
esf
->
x15
>>
32
,
esf
->
x15
&
UINT32_MAX
);
rt_kprintf
(
"x16(a6 : Function argument ) ==> 0x%08x%08x
\n
"
,
esf
->
x16
>>
32
,
esf
->
x16
&
UINT32_MAX
);
rt_kprintf
(
"x17(a7 : Function argument ) ==> 0x%08x%08x
\n
"
,
esf
->
x17
>>
32
,
esf
->
x17
&
UINT32_MAX
);
rt_kprintf
(
"x18(s2 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x18
>>
32
,
esf
->
x18
&
UINT32_MAX
);
rt_kprintf
(
"x19(s3 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x19
>>
32
,
esf
->
x19
&
UINT32_MAX
);
rt_kprintf
(
"x20(s4 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x20
>>
32
,
esf
->
x20
&
UINT32_MAX
);
rt_kprintf
(
"x21(s5 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x21
>>
32
,
esf
->
x21
&
UINT32_MAX
);
rt_kprintf
(
"x22(s6 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x22
>>
32
,
esf
->
x22
&
UINT32_MAX
);
rt_kprintf
(
"x23(s7 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x23
>>
32
,
esf
->
x23
&
UINT32_MAX
);
rt_kprintf
(
"x24(s8 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x24
>>
32
,
esf
->
x24
&
UINT32_MAX
);
rt_kprintf
(
"x25(s9 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x25
>>
32
,
esf
->
x25
&
UINT32_MAX
);
rt_kprintf
(
"x26(s10 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x26
>>
32
,
esf
->
x26
&
UINT32_MAX
);
rt_kprintf
(
"x27(s11 : Save register ) ==> 0x%08x%08x
\n
"
,
esf
->
x27
>>
32
,
esf
->
x27
&
UINT32_MAX
);
rt_kprintf
(
"x28(t3 : Temporary ) ==> 0x%08x%08x
\n
"
,
esf
->
x28
>>
32
,
esf
->
x28
&
UINT32_MAX
);
rt_kprintf
(
"x29(t4 : Temporary ) ==> 0x%08x%08x
\n
"
,
esf
->
x29
>>
32
,
esf
->
x29
&
UINT32_MAX
);
rt_kprintf
(
"x30(t5 : Temporary ) ==> 0x%08x%08x
\n
"
,
esf
->
x30
>>
32
,
esf
->
x30
&
UINT32_MAX
);
rt_kprintf
(
"x31(t6 : Temporary ) ==> 0x%08x%08x
\n
"
,
esf
->
x31
>>
32
,
esf
->
x31
&
UINT32_MAX
);
rt_kprintf
(
"=================================================================
\n
"
);
}
uintptr_t
handle_trap
(
uintptr_t
mcause
,
uintptr_t
epc
)
uintptr_t
handle_trap
(
uintptr_t
mcause
,
uintptr_t
epc
,
uintptr_t
*
sp
)
{
int
cause
=
mcause
&
CAUSE_MACHINE_IRQ_REASON_MASK
;
...
...
@@ -310,6 +384,7 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc)
break
;
}
rt_kprintf
(
"
\n
"
);
print_stack_frame
(
sp
);
rt_kprintf
(
"exception pc => 0x%08x
\n
"
,
epc
);
rt_kprintf
(
"current thread: %.*s
\n
"
,
RT_NAME_MAX
,
tid
->
name
);
#ifdef RT_USING_FINSH
...
...
libcpu/risc-v/k210/interrupt_gcc.S
浏览文件 @
c41bf312
...
...
@@ -69,7 +69,7 @@ trap_entry:
call
rt_interrupt_enter
csrr
a0
,
mcause
csrr
a1
,
mepc
mv
a2
,
s
p
mv
a2
,
s
0
call
handle_trap
call
rt_interrupt_leave
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录