summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorLim-LinYuanbo <[email protected]>2021-09-08 22:45:31 +0800
committerGitHub <[email protected]>2021-09-08 22:45:31 +0800
commitb404f69f851817c62697074ffb363294b91585c6 (patch)
treef5f31152993843a5e07559a6b7b0caddcc9ebd0a /libcpu
parent49fcf9f4cd436d30d2df8c4e24b751194c32f43b (diff)
parent7fa1c819ee852937705d948a58f0218c422ea6b1 (diff)
Merge branch 'master' into master
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/aarch64/cortex-a53/trap.c4
-rw-r--r--libcpu/aarch64/cortex-a72/trap.c4
-rw-r--r--libcpu/arm/am335x/trap.c8
-rw-r--r--libcpu/arm/arm926/trap.c8
-rw-r--r--libcpu/arm/cortex-a/trap.c12
-rw-r--r--libcpu/arm/cortex-m0/cpuport.c4
-rw-r--r--libcpu/arm/cortex-m23/cpuport.c4
-rw-r--r--libcpu/arm/cortex-m3/cpuport.c6
-rw-r--r--libcpu/arm/cortex-m33/cpuport.c4
-rw-r--r--libcpu/arm/cortex-m4/cpuport.c4
-rw-r--r--libcpu/arm/cortex-m7/cpuport.c4
-rw-r--r--libcpu/arm/cortex-r4/trap.c8
-rw-r--r--libcpu/arm/realview-a8-vmm/trap.c12
-rw-r--r--libcpu/arm/s3c24x0/trap.c8
-rw-r--r--libcpu/arm/zynqmp-r5/trap.c12
-rw-r--r--libcpu/risc-v/k210/interrupt.c4
-rw-r--r--libcpu/risc-v/t-head/e9xx/context_gcc.S26
-rw-r--r--libcpu/risc-v/t-head/e9xx/cpuport.c9
-rw-r--r--libcpu/risc-v/t-head/e9xx/cpuport.h1
-rw-r--r--libcpu/risc-v/virt64/interrupt.c5
-rw-r--r--libcpu/rx/cpuport.c4
21 files changed, 81 insertions, 70 deletions
diff --git a/libcpu/aarch64/cortex-a53/trap.c b/libcpu/aarch64/cortex-a53/trap.c
index ca5b6ecd44..6002713543 100644
--- a/libcpu/aarch64/cortex-a53/trap.c
+++ b/libcpu/aarch64/cortex-a53/trap.c
@@ -19,7 +19,7 @@
#endif
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -55,7 +55,7 @@ void rt_hw_trap_error(struct rt_hw_exp_stack *regs)
{
rt_kprintf("error exception:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/aarch64/cortex-a72/trap.c b/libcpu/aarch64/cortex-a72/trap.c
index bd76f7717b..ba96f03a69 100644
--- a/libcpu/aarch64/cortex-a72/trap.c
+++ b/libcpu/aarch64/cortex-a72/trap.c
@@ -14,7 +14,7 @@
#include "armv8.h"
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -50,7 +50,7 @@ void rt_hw_trap_error(struct rt_hw_exp_stack *regs)
{
rt_kprintf("error exception:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/am335x/trap.c b/libcpu/arm/am335x/trap.c
index 7c73ce93d3..19cb31ad67 100644
--- a/libcpu/arm/am335x/trap.c
+++ b/libcpu/arm/am335x/trap.c
@@ -24,7 +24,7 @@
/*@{*/
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -67,7 +67,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n");
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -105,7 +105,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
rt_kprintf("prefetch abort\n");
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -133,7 +133,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
rt_kprintf("data abort\n");
rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/arm926/trap.c b/libcpu/arm/arm926/trap.c
index c364b2addd..c1b1ffe912 100644
--- a/libcpu/arm/arm926/trap.c
+++ b/libcpu/arm/arm926/trap.c
@@ -16,7 +16,7 @@
#define INT_FIQ 0x01
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -90,7 +90,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -142,7 +142,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
rt_kprintf("prefetch abort\n");
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -170,7 +170,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
rt_kprintf("data abort\n");
rt_kprintf("thread - %s stack:\n", RT_NAME_MAX, rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/cortex-a/trap.c b/libcpu/arm/cortex-a/trap.c
index b3efe31a64..814db418cd 100644
--- a/libcpu/arm/cortex-a/trap.c
+++ b/libcpu/arm/cortex-a/trap.c
@@ -15,7 +15,7 @@
#include "armv7.h"
#include "interrupt.h"
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -89,7 +89,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -115,7 +115,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{
rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -140,7 +140,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -165,7 +165,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -189,7 +189,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{
rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/cortex-m0/cpuport.c b/libcpu/arm/cortex-m0/cpuport.c
index 49e15bf339..af343aa8b2 100644
--- a/libcpu/arm/cortex-m0/cpuport.c
+++ b/libcpu/arm/cortex-m0/cpuport.c
@@ -90,7 +90,9 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
return stk;
}
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
extern rt_thread_t rt_current_thread;
/**
* fault exception handling
@@ -108,7 +110,7 @@ void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
diff --git a/libcpu/arm/cortex-m23/cpuport.c b/libcpu/arm/cortex-m23/cpuport.c
index d8f9b12c2c..a3b18f5f35 100644
--- a/libcpu/arm/cortex-m23/cpuport.c
+++ b/libcpu/arm/cortex-m23/cpuport.c
@@ -91,7 +91,9 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
return stk;
}
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
extern rt_thread_t rt_current_thread;
/**
* fault exception handling
@@ -109,7 +111,7 @@ void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
diff --git a/libcpu/arm/cortex-m3/cpuport.c b/libcpu/arm/cortex-m3/cpuport.c
index 19c33bd7c9..d376f00424 100644
--- a/libcpu/arm/cortex-m3/cpuport.c
+++ b/libcpu/arm/cortex-m3/cpuport.c
@@ -291,7 +291,9 @@ struct exception_info
*/
void rt_hw_hard_fault_exception(struct exception_info * exception_info)
{
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
struct stack_frame* context = &exception_info->stack_frame;
if (rt_exception_hook != RT_NULL)
@@ -325,9 +327,9 @@ void rt_hw_hard_fault_exception(struct exception_info * exception_info)
{
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
-#endif /* RT_USING_FINSH */
+#endif
}
else
{
diff --git a/libcpu/arm/cortex-m33/cpuport.c b/libcpu/arm/cortex-m33/cpuport.c
index 928689d9c8..aa2325012c 100644
--- a/libcpu/arm/cortex-m33/cpuport.c
+++ b/libcpu/arm/cortex-m33/cpuport.c
@@ -373,7 +373,9 @@ struct exception_info
void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_stack_frame;
struct stack_frame *context = &exception_info->stack_frame;
@@ -407,7 +409,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
}
diff --git a/libcpu/arm/cortex-m4/cpuport.c b/libcpu/arm/cortex-m4/cpuport.c
index dbc42d21cf..f24c33cf4d 100644
--- a/libcpu/arm/cortex-m4/cpuport.c
+++ b/libcpu/arm/cortex-m4/cpuport.c
@@ -370,7 +370,9 @@ struct exception_info
void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_stack_frame;
struct stack_frame *context = &exception_info->stack_frame;
@@ -404,7 +406,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
}
diff --git a/libcpu/arm/cortex-m7/cpuport.c b/libcpu/arm/cortex-m7/cpuport.c
index dbc42d21cf..f24c33cf4d 100644
--- a/libcpu/arm/cortex-m7/cpuport.c
+++ b/libcpu/arm/cortex-m7/cpuport.c
@@ -370,7 +370,9 @@ struct exception_info
void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
+#endif
struct exception_stack_frame *exception_stack = &exception_info->stack_frame.exception_stack_frame;
struct stack_frame *context = &exception_info->stack_frame;
@@ -404,7 +406,7 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
{
rt_kprintf("hard fault on thread: %s\r\n\r\n", rt_thread_self()->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
}
diff --git a/libcpu/arm/cortex-r4/trap.c b/libcpu/arm/cortex-r4/trap.c
index e6c62390c1..3ff3d297c0 100644
--- a/libcpu/arm/cortex-r4/trap.c
+++ b/libcpu/arm/cortex-r4/trap.c
@@ -67,7 +67,7 @@ void rt_hw_trap_svc(struct rt_hw_exp_stack *regs)
{
rt_kprintf("software interrupt\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -85,7 +85,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("prefetch abort\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -103,7 +103,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("Data Abort ");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -120,7 +120,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{
rt_kprintf("Reserved trap\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/realview-a8-vmm/trap.c b/libcpu/arm/realview-a8-vmm/trap.c
index c6ca45aee7..86eceb39cf 100644
--- a/libcpu/arm/realview-a8-vmm/trap.c
+++ b/libcpu/arm/realview-a8-vmm/trap.c
@@ -21,7 +21,7 @@
#include "gic.h"
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -53,7 +53,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -72,7 +72,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{
rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -90,7 +90,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -108,7 +108,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -125,7 +125,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{
rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/s3c24x0/trap.c b/libcpu/arm/s3c24x0/trap.c
index f0e8a7097a..c4be806dc6 100644
--- a/libcpu/arm/s3c24x0/trap.c
+++ b/libcpu/arm/s3c24x0/trap.c
@@ -22,7 +22,7 @@
/*@{*/
extern struct rt_thread *rt_current_thread;
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -58,7 +58,7 @@ void rt_hw_trap_udef(struct rt_hw_register *regs)
rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -96,7 +96,7 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs)
rt_kprintf("prefetch abort\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -117,7 +117,7 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs)
rt_kprintf("data abort\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/arm/zynqmp-r5/trap.c b/libcpu/arm/zynqmp-r5/trap.c
index 64d4cbf5e8..5db5a0c01b 100644
--- a/libcpu/arm/zynqmp-r5/trap.c
+++ b/libcpu/arm/zynqmp-r5/trap.c
@@ -16,7 +16,7 @@
#include "armv7.h"
#include "interrupt.h"
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
@@ -48,7 +48,7 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
rt_kprintf("undefined instruction:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -67,7 +67,7 @@ void rt_hw_trap_swi(struct rt_hw_exp_stack *regs)
{
rt_kprintf("software interrupt:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -85,7 +85,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("prefetch abort:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -103,7 +103,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
{
rt_kprintf("data abort:");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
@@ -120,7 +120,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
{
rt_kprintf("reserved trap:\n");
rt_hw_show_register(regs);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
rt_hw_cpu_shutdown();
diff --git a/libcpu/risc-v/k210/interrupt.c b/libcpu/risc-v/k210/interrupt.c
index 934acbdbf8..b5384b01ee 100644
--- a/libcpu/risc-v/k210/interrupt.c
+++ b/libcpu/risc-v/k210/interrupt.c
@@ -335,7 +335,9 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t * sp)
else
{
rt_thread_t tid;
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread();
+#endif
rt_hw_interrupt_disable();
@@ -387,7 +389,7 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t * sp)
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
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
while(1);
diff --git a/libcpu/risc-v/t-head/e9xx/context_gcc.S b/libcpu/risc-v/t-head/e9xx/context_gcc.S
index 9deaf80e41..b6adb65ff7 100644
--- a/libcpu/risc-v/t-head/e9xx/context_gcc.S
+++ b/libcpu/risc-v/t-head/e9xx/context_gcc.S
@@ -1,11 +1,13 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2021, Alibaba Group Holding Limited
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020/08/20 zx.chen The T-HEAD RISC-V CPU E906 porting implementation
+ * 2021/08/13 zx.chen update T-HEAD E9xx-series(E906/7/F/D/P) CPU porting code.
*/
#include "cpuport.h"
@@ -29,8 +31,6 @@ vPortYield:
ret
-
-
/*
* #ifdef RT_USING_SMP
* void rt_hw_context_switch_to(rt_ubase_t to, stuct rt_thread *to_thread);
@@ -56,12 +56,10 @@ rt_hw_context_switch_to:
li t1, 1
STORE t1, (t0)
- /* enable mexstatus SPUSHEN and SPSWAPEN */
-#if ((CONFIG_CPU_E906==1) || (CONFIG_CPU_E906F==1) || (CONFIG_CPU_E906FD==1))
- uint32_t mexstatus;
- mexstatus = __get_MEXSTATUS();
- mexstatus |= (0x2 << 16);
- __set_MEXSTATUS(mexstatus);
+ /* enable mexstatus SPUSHEN */
+#ifdef CONFIG_THEAD_EXT_SPUSHEN
+ li t0, 0x10000
+ csrs mexstatus, t0
#endif
csrw mscratch, sp
@@ -140,7 +138,7 @@ PendSV_Handler:
lw t1, (t0)
beqz t1, .switch_to_thead
- /* save from thread context */
+ /* restore from thread context t0,t1 */
lw t0, (-4)(sp)
lw t1, (-8)(sp)
@@ -191,10 +189,6 @@ PendSV_Handler:
csrr x1, mepc
STORE x1, 0 * REGBYTES(sp)
csrr x1, mstatus
- andi x1, x1, 8
- beqz x1, .save_mpie
- li x1, 0x80
-.save_mpie:
STORE x1, 2 * REGBYTES(sp)
/* x3 don't need save */
STORE x4, 4 * REGBYTES(sp)
@@ -256,11 +250,9 @@ PendSV_Handler:
csrw mepc, a1
LOAD x1, 1 * REGBYTES(sp)
- /* force to machin mode(MPP=11) */
- li a1, 0x1880
- csrs mstatus, a1
+ /* force to machine mode(MPP=11) */
LOAD a1, 2 * REGBYTES(sp)
- csrs mstatus, a1
+ csrw mstatus, a1
/* x3 don't need restore */
LOAD x4, 4 * REGBYTES(sp)
LOAD x5, 5 * REGBYTES(sp)
diff --git a/libcpu/risc-v/t-head/e9xx/cpuport.c b/libcpu/risc-v/t-head/e9xx/cpuport.c
index 6fa41b6da6..e93dd67dc3 100644
--- a/libcpu/risc-v/t-head/e9xx/cpuport.c
+++ b/libcpu/risc-v/t-head/e9xx/cpuport.c
@@ -1,11 +1,13 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
+ * Copyright (c) 2021, Alibaba Group Holding Limited
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020/08/20 zx.chen The T-HEAD RISC-V CPU E906 porting code.
+ * 2021/08/13 zx.chen update T-HEAD E9xx-series(E906/7/F/D/P) CPU porting code.
*/
#include <rthw.h>
@@ -143,8 +145,8 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
rt_base_t rt_hw_interrupt_disable(void)
{
- __asm volatile("csrc mstatus, 8");
- return 0;
+ __asm volatile("csrrci a0, mstatus, 8");
+ return;
}
/**
@@ -154,9 +156,10 @@ rt_base_t rt_hw_interrupt_disable(void)
*
* @return none
*/
+/* XXX:rename rt_hw_interrupt_restore? */
void rt_hw_interrupt_enable(rt_base_t level)
{
- __asm volatile("csrs mstatus, 8");
+ __asm volatile("csrw mstatus, a0");
}
/** shutdown CPU */
diff --git a/libcpu/risc-v/t-head/e9xx/cpuport.h b/libcpu/risc-v/t-head/e9xx/cpuport.h
index 20302f44aa..4f01d2127c 100644
--- a/libcpu/risc-v/t-head/e9xx/cpuport.h
+++ b/libcpu/risc-v/t-head/e9xx/cpuport.h
@@ -12,6 +12,7 @@
#define CPUPORT_H__
#include <rtconfig.h>
+#include <theadconfig.h>
/* bytes of register width */
#ifdef ARCH_RISCV_64
diff --git a/libcpu/risc-v/virt64/interrupt.c b/libcpu/risc-v/virt64/interrupt.c
index 7916be8f6f..eae0a55c96 100644
--- a/libcpu/risc-v/virt64/interrupt.c
+++ b/libcpu/risc-v/virt64/interrupt.c
@@ -212,8 +212,9 @@ void handle_trap(rt_size_t xcause,rt_size_t xtval,rt_size_t xepc,struct rt_hw_st
else
{
rt_thread_t tid;
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread();
-
+#endif
rt_hw_interrupt_disable();
rt_kprintf("xcause = %08x,xtval = %08x,xepc = %08x\n", xcause, xtval, xepc);
@@ -265,7 +266,7 @@ void handle_trap(rt_size_t xcause,rt_size_t xtval,rt_size_t xepc,struct rt_hw_st
dump_regs(sp);
rt_kprintf("exception pc => 0x%08x\n", xepc);
rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, tid->name);
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
while(1);
diff --git a/libcpu/rx/cpuport.c b/libcpu/rx/cpuport.c
index 00f9e26ba9..366569f63d 100644
--- a/libcpu/rx/cpuport.c
+++ b/libcpu/rx/cpuport.c
@@ -94,7 +94,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
return(rt_uint8_t *)stack_frame;
}
-#ifdef RT_USING_FINSH
+#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern void list_thread(void);
#endif
extern rt_thread_t rt_current_thread;
@@ -130,7 +130,7 @@ void rt_hw_hard_fault_exception(struct stack_frame* exception_contex)
rt_kprintf("acclo: 0x%08x\n", exception_contex->ACCLO);
}
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
- #ifdef RT_USING_FINSH
+ #if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
while (1);