bl30: rtos_sdk add a hint print for exception info [1/1]
PD#SWPL-128680
Problem:
Currently, bl30 rtos_sdk has no hint for exception.
Thus we wouldn't know the detail information when
system enter exception.
Solution:
Add a hint print for exception info.
Verify:
t3x_bc302
Change-Id: I9e40f48997f99a81be8d9ab67649abb47e253084
Signed-off-by: bangzheng.liu <bangzheng.liu@amlogic.com>
diff --git a/GCC/AML_RISC-V/port.c b/GCC/AML_RISC-V/port.c
index fee8874..f2285e4 100755
--- a/GCC/AML_RISC-V/port.c
+++ b/GCC/AML_RISC-V/port.c
@@ -83,6 +83,7 @@
{
int i = 0;
uint32_t mstatus_mps_bits;
+ char *exception_info = NULL;
switch (mcause&0X00000fff) {
//on User and Machine ECALL, handler the request
@@ -113,10 +114,41 @@
break;
default:
+ switch (mcause & 0xf) {
+ case 0:
+ exception_info = "Instruction address misaligned";
+ break;
+ case 1:
+ exception_info = "Instruction access fault";
+ break;
+ case 2:
+ exception_info = "Illegal instruction";
+ break;
+ case 3:
+ exception_info = "Breakpoint";
+ break;
+ case 4:
+ exception_info = "Load address misaligned";
+ break;
+ case 5:
+ exception_info = "Load access fault";
+ break;
+ case 6:
+ exception_info = "Store/AMO address misaligned";
+ break;
+ case 7:
+ exception_info = "Store/AMO access fault";
+ break;
+ default:
+ exception_info = "not defined, pls check riscv guide";
+ break;
+ }
+
mstatus_mps_bits = ((read_csr(mstatus) & 0x00000600) >> 9);
printf("In trap handler, the msubmode is 0x%lx\n", read_csr_msubmode);
printf("In trap handler, the mstatus.MPS is 0x%lx\n", mstatus_mps_bits);
- printf("In trap handler, the mcause is %lx\n", mcause);
+ printf("In trap handler, the mcause is %lx, exception info: %s\n",
+ mcause, exception_info);
printf("In trap handler, the mepc is 0x%lx\n", read_csr(mepc));
printf("In trap handler, the mtval is 0x%lx\n", read_csr(mbadaddr));
if (mstatus_mps_bits == 0x1) {