cortex-r4: dump register on traps
We could not handle any traps except IRQ/FIQ.
This commit is contained in:
parent
e1e563e85c
commit
377c6e6cc9
|
@ -5,10 +5,9 @@
|
||||||
#define VFP_DATA_NR 32
|
#define VFP_DATA_NR 32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* the stack without VFP registers */
|
/* the exception stack without VFP registers */
|
||||||
struct rt_hw_base_stack
|
struct rt_hw_exp_stack
|
||||||
{
|
{
|
||||||
unsigned long cpsr;
|
|
||||||
unsigned long r0;
|
unsigned long r0;
|
||||||
unsigned long r1;
|
unsigned long r1;
|
||||||
unsigned long r2;
|
unsigned long r2;
|
||||||
|
@ -22,8 +21,10 @@ struct rt_hw_base_stack
|
||||||
unsigned long r10;
|
unsigned long r10;
|
||||||
unsigned long fp;
|
unsigned long fp;
|
||||||
unsigned long ip;
|
unsigned long ip;
|
||||||
|
unsigned long sp;
|
||||||
unsigned long lr;
|
unsigned long lr;
|
||||||
unsigned long pc;
|
unsigned long pc;
|
||||||
|
unsigned long cpsr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define USERMODE 0x10
|
#define USERMODE 0x10
|
||||||
|
|
|
@ -492,14 +492,54 @@ turnon_VFP
|
||||||
subs pc, lr, #4
|
subs pc, lr, #4
|
||||||
.endasmfunc
|
.endasmfunc
|
||||||
|
|
||||||
.def _dabort
|
_push_svc_reg .macro
|
||||||
.asmfunc
|
sub sp, sp, #17 * 4 ;/* Sizeof(struct rt_hw_exp_stack) */
|
||||||
|
stmia sp, {r0 - r12} ;/* Calling r0-r12 */
|
||||||
|
mov r0, sp
|
||||||
|
mrs r6, spsr ;/* Save CPSR */
|
||||||
|
str lr, [r0, #15*4] ;/* Push PC */
|
||||||
|
str r6, [r0, #16*4] ;/* Push CPSR */
|
||||||
|
cps #0x13
|
||||||
|
str sp, [r0, #13*4] ;/* Save calling SP */
|
||||||
|
str lr, [r0, #14*4] ;/* Save calling PC */
|
||||||
|
.endm
|
||||||
|
|
||||||
_dabort
|
.ref rt_hw_trap_svc
|
||||||
stmfd r13!, {r0 - r12, lr}
|
.def vector_svc
|
||||||
ldmfd r13!, {r0 - r12, lr}
|
.asmfunc
|
||||||
subs pc, lr, #8
|
vector_svc:
|
||||||
|
_push_svc_reg
|
||||||
|
bl rt_hw_trap_svc
|
||||||
|
sub pc, pc, #-4
|
||||||
.endasmfunc
|
.endasmfunc
|
||||||
|
|
||||||
|
.ref rt_hw_trap_pabt
|
||||||
|
.def vector_pabort
|
||||||
|
.asmfunc
|
||||||
|
vector_pabort:
|
||||||
|
_push_svc_reg
|
||||||
|
bl rt_hw_trap_pabt
|
||||||
|
sub pc, pc, #-4
|
||||||
|
.endasmfunc
|
||||||
|
|
||||||
|
.ref rt_hw_trap_dabt
|
||||||
|
.def vector_dabort
|
||||||
|
.asmfunc
|
||||||
|
vector_dabort:
|
||||||
|
_push_svc_reg
|
||||||
|
bl rt_hw_trap_dabt
|
||||||
|
sub pc, pc, #-4
|
||||||
|
.endasmfunc
|
||||||
|
|
||||||
|
.ref rt_hw_trap_resv
|
||||||
|
.def vector_resv
|
||||||
|
.asmfunc
|
||||||
|
vector_resv:
|
||||||
|
_push_svc_reg
|
||||||
|
bl rt_hw_trap_resv
|
||||||
|
sub pc, pc, #-4
|
||||||
|
.endasmfunc
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; C++ construct table pointers
|
; C++ construct table pointers
|
||||||
|
|
||||||
|
@ -509,7 +549,4 @@ _dabort
|
||||||
__TI_PINIT_Base .long SHT$$INIT_ARRAY$$Base
|
__TI_PINIT_Base .long SHT$$INIT_ARRAY$$Base
|
||||||
__TI_PINIT_Limit .long SHT$$INIT_ARRAY$$Limit
|
__TI_PINIT_Limit .long SHT$$INIT_ARRAY$$Limit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -445,8 +445,38 @@ turnon_VFP:
|
||||||
LDMIA sp!, {r0}
|
LDMIA sp!, {r0}
|
||||||
subs pc, lr, #4
|
subs pc, lr, #4
|
||||||
|
|
||||||
.globl _dabort
|
.macro push_svc_reg
|
||||||
_dabort:
|
sub sp, sp, #17 * 4 @/* Sizeof(struct rt_hw_exp_stack) */
|
||||||
stmfd r13!, {r0 - r12, lr}
|
stmia sp, {r0 - r12} @/* Calling r0-r12 */
|
||||||
ldmfd r13!, {r0 - r12, lr}
|
mov r0, sp
|
||||||
subs pc, lr, #8
|
mrs r6, spsr @/* Save CPSR */
|
||||||
|
str lr, [r0, #15*4] @/* Push PC */
|
||||||
|
str r6, [r0, #16*4] @/* Push CPSR */
|
||||||
|
cps #Mode_SVC
|
||||||
|
str sp, [r0, #13*4] @/* Save calling SP */
|
||||||
|
str lr, [r0, #14*4] @/* Save calling PC */
|
||||||
|
.endm
|
||||||
|
|
||||||
|
.globl vector_svc
|
||||||
|
vector_svc:
|
||||||
|
push_svc_reg
|
||||||
|
bl rt_hw_trap_svc
|
||||||
|
b .
|
||||||
|
|
||||||
|
.globl vector_pabort
|
||||||
|
vector_pabort:
|
||||||
|
push_svc_reg
|
||||||
|
bl rt_hw_trap_pabt
|
||||||
|
b .
|
||||||
|
|
||||||
|
.globl vector_dabort
|
||||||
|
vector_dabort:
|
||||||
|
push_svc_reg
|
||||||
|
bl rt_hw_trap_dabt
|
||||||
|
b .
|
||||||
|
|
||||||
|
.globl vector_resv
|
||||||
|
vector_resv:
|
||||||
|
push_svc_reg
|
||||||
|
bl rt_hw_trap_resv
|
||||||
|
b .
|
||||||
|
|
|
@ -30,14 +30,14 @@
|
||||||
*
|
*
|
||||||
* @param regs the registers point
|
* @param regs the registers point
|
||||||
*/
|
*/
|
||||||
void rt_hw_show_register (struct rt_hw_base_stack *regs)
|
void rt_hw_show_register (struct rt_hw_exp_stack *regs)
|
||||||
{
|
{
|
||||||
rt_kprintf("Execption:\n");
|
rt_kprintf("Execption:\n");
|
||||||
rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3);
|
rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3);
|
||||||
rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7);
|
rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7);
|
||||||
rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10);
|
rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10);
|
||||||
rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip);
|
rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip);
|
||||||
rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs+1, regs->lr, regs->pc);
|
rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc);
|
||||||
rt_kprintf("cpsr:0x%08x\n", regs->cpsr);
|
rt_kprintf("cpsr:0x%08x\n", regs->cpsr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ void rt_hw_show_register (struct rt_hw_base_stack *regs)
|
||||||
*
|
*
|
||||||
* @note never invoke this function in application
|
* @note never invoke this function in application
|
||||||
*/
|
*/
|
||||||
void rt_hw_trap_udef(struct rt_hw_base_stack *regs)
|
void rt_hw_trap_udef(struct rt_hw_exp_stack *regs)
|
||||||
{
|
{
|
||||||
rt_kprintf("undefined instruction\n");
|
rt_kprintf("undefined instruction\n");
|
||||||
rt_hw_show_register(regs);
|
rt_hw_show_register(regs);
|
||||||
|
@ -67,12 +67,13 @@ void rt_hw_trap_udef(struct rt_hw_base_stack *regs)
|
||||||
*
|
*
|
||||||
* @note never invoke this function in application
|
* @note never invoke this function in application
|
||||||
*/
|
*/
|
||||||
void rt_hw_trap_swi(struct rt_hw_base_stack *regs)
|
void rt_hw_trap_svc(struct rt_hw_exp_stack *regs)
|
||||||
{
|
{
|
||||||
rt_kprintf("software interrupt\n");
|
rt_kprintf("software interrupt\n");
|
||||||
rt_hw_show_register(regs);
|
rt_hw_show_register(regs);
|
||||||
if (rt_thread_self() != RT_NULL)
|
#ifdef RT_USING_FINSH
|
||||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
list_thread();
|
||||||
|
#endif
|
||||||
rt_hw_cpu_shutdown();
|
rt_hw_cpu_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,12 +85,13 @@ void rt_hw_trap_swi(struct rt_hw_base_stack *regs)
|
||||||
*
|
*
|
||||||
* @note never invoke this function in application
|
* @note never invoke this function in application
|
||||||
*/
|
*/
|
||||||
void rt_hw_trap_pabt(struct rt_hw_base_stack *regs)
|
void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs)
|
||||||
{
|
{
|
||||||
rt_kprintf("prefetch abort\n");
|
rt_kprintf("prefetch abort\n");
|
||||||
rt_hw_show_register(regs);
|
rt_hw_show_register(regs);
|
||||||
if (rt_thread_self() != RT_NULL)
|
#ifdef RT_USING_FINSH
|
||||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
list_thread();
|
||||||
|
#endif
|
||||||
rt_hw_cpu_shutdown();
|
rt_hw_cpu_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,12 +103,13 @@ void rt_hw_trap_pabt(struct rt_hw_base_stack *regs)
|
||||||
*
|
*
|
||||||
* @note never invoke this function in application
|
* @note never invoke this function in application
|
||||||
*/
|
*/
|
||||||
void rt_hw_trap_dabt(struct rt_hw_base_stack *regs)
|
void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs)
|
||||||
{
|
{
|
||||||
rt_kprintf("Data Abort ");
|
rt_kprintf("Data Abort ");
|
||||||
rt_hw_show_register(regs);
|
rt_hw_show_register(regs);
|
||||||
if (rt_thread_self() != RT_NULL)
|
#ifdef RT_USING_FINSH
|
||||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
list_thread();
|
||||||
|
#endif
|
||||||
rt_hw_cpu_shutdown();
|
rt_hw_cpu_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,12 +120,13 @@ void rt_hw_trap_dabt(struct rt_hw_base_stack *regs)
|
||||||
*
|
*
|
||||||
* @note never invoke this function in application
|
* @note never invoke this function in application
|
||||||
*/
|
*/
|
||||||
void rt_hw_trap_resv(struct rt_hw_base_stack *regs)
|
void rt_hw_trap_resv(struct rt_hw_exp_stack *regs)
|
||||||
{
|
{
|
||||||
rt_kprintf("not used\n");
|
rt_kprintf("Reserved trap\n");
|
||||||
rt_hw_show_register(regs);
|
rt_hw_show_register(regs);
|
||||||
if (rt_thread_self() != RT_NULL)
|
#ifdef RT_USING_FINSH
|
||||||
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
|
list_thread();
|
||||||
|
#endif
|
||||||
rt_hw_cpu_shutdown();
|
rt_hw_cpu_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,25 +11,23 @@
|
||||||
; import reference for interrupt routines
|
; import reference for interrupt routines
|
||||||
|
|
||||||
.ref _reset
|
.ref _reset
|
||||||
.ref _dabort
|
|
||||||
.ref turnon_VFP
|
.ref turnon_VFP
|
||||||
|
.ref vector_svc
|
||||||
|
.ref vector_pabort
|
||||||
|
.ref vector_dabort
|
||||||
|
.ref vector_resv
|
||||||
.ref IRQ_Handler
|
.ref IRQ_Handler
|
||||||
|
|
||||||
.def resetEntry
|
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; interrupt vectors
|
; interrupt vectors
|
||||||
|
.def resetEntry
|
||||||
resetEntry
|
resetEntry
|
||||||
b _reset
|
b _reset
|
||||||
b turnon_VFP
|
b turnon_VFP
|
||||||
svcEntry
|
b vector_svc
|
||||||
b svcEntry
|
b vector_pabort
|
||||||
prefetchEntry
|
b vector_dabort
|
||||||
b prefetchEntry
|
b vector_resv
|
||||||
b _dabort
|
|
||||||
reservedEntry
|
|
||||||
b reservedEntry
|
|
||||||
b IRQ_Handler
|
b IRQ_Handler
|
||||||
ldr pc,[pc,#-0x1b0]
|
ldr pc,[pc,#-0x1b0]
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,11 @@
|
||||||
@ import reference for interrupt routines
|
@ import reference for interrupt routines
|
||||||
|
|
||||||
.globl _reset
|
.globl _reset
|
||||||
.globl _dabort
|
|
||||||
.globl turnon_VFP
|
.globl turnon_VFP
|
||||||
|
.globl vector_svc
|
||||||
|
.globl vector_pabort
|
||||||
|
.globl vector_dabort
|
||||||
|
.globl vector_resv
|
||||||
.globl IRQ_Handler
|
.globl IRQ_Handler
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,12 +23,9 @@
|
||||||
system_vectors:
|
system_vectors:
|
||||||
b _reset
|
b _reset
|
||||||
b turnon_VFP
|
b turnon_VFP
|
||||||
svcEntry:
|
b vector_svc
|
||||||
b svcEntry
|
b vector_pabort
|
||||||
prefetchEntry:
|
b vector_dabort
|
||||||
b prefetchEntry
|
b vector_resv
|
||||||
b _dabort
|
|
||||||
reservedEntry:
|
|
||||||
b reservedEntry
|
|
||||||
b IRQ_Handler
|
b IRQ_Handler
|
||||||
ldr pc,[pc,#-0x1b0]
|
ldr pc,[pc,#-0x1b0]
|
||||||
|
|
Loading…
Reference in New Issue