Part Number: MCU-PLUS-SDK-AM243X
Hi TI experts,
we are trying to get some detailed exception information after specififc exceptions.
We're using the SDK version V08.03.00.18 and will use the SDK V08.04.01/V08.05 with FreeRTOS.
We understand that after an exception we will be in an endless loop in "HwiP_armv7r_handlers_freertos.c".
void __attribute__((interrupt("UNDEF"), section(".text.hwi"))) HwiP_reserved_handler(void)
{
volatile uint32_t loop = 1;
while(loop)
;
}
void __attribute__((interrupt("UNDEF"), section(".text.hwi"))) HwiP_undefined_handler(void)
{
volatile uint32_t loop = 1;
while(loop)
;
}
void __attribute__((interrupt("ABORT"), section(".text.hwi"))) HwiP_prefetch_abort_handler(void)
{
volatile uint32_t loop = 1;
while(loop)
;
}
void __attribute__((interrupt("ABORT"), section(".text.hwi"))) HwiP_data_abort_handler(void)
{
volatile uint32_t loop = 1;
while(loop)
;
}
We tried to access the information with the following implementation:
T_CPUREGISTER tCpuRegister;
uint32_t u32CpuR0;
#define GET_CPUREGISTER \
asm ("mov %[data], r14;" : [data] "=&r" (tCpuRegister.u32PC) : ); \
asm ("push {r1};" ); \
asm ("mov r1, r0;" ); \
asm ("mov %[data], r1;" : [data] "=&r" (tCpuRegister.u32R0) : ); \
asm ("pop {r1};" ); \
asm ("mov %[data], r1;" : [data] "=&r" (tCpuRegister.u32R1) : ); \
asm ("mov %[data], r2;" : [data] "=&r" (tCpuRegister.u32R2) : ); \
asm ("mov %[data], r3;" : [data] "=&r" (tCpuRegister.u32R3) : ); \
asm ("mov %[data], r4;" : [data] "=&r" (tCpuRegister.u32R4) : ); \
asm ("mov %[data], r5;" : [data] "=&r" (tCpuRegister.u32R5) : ); \
asm ("mov %[data], r6;" : [data] "=&r" (tCpuRegister.u32R6) : ); \
asm ("mov %[data], r7;" : [data] "=&r" (tCpuRegister.u32R7) : ); \
asm ("mov %[data], r8;" : [data] "=&r" (tCpuRegister.u32R8) : ); \
asm ("mov %[data], r9;" : [data] "=&r" (tCpuRegister.u32R9) : ); \
asm ("mov %[data], r10;" : [data] "=&r" (tCpuRegister.u32R10) : ); \
asm ("mov %[data], r11;" : [data] "=&r" (tCpuRegister.u32R11) : ); \
asm ("mov %[data], r12;" : [data] "=&r" (tCpuRegister.u32SP) : ); \
asm ("mov %[data], r13;" : [data] "=&r" (tCpuRegister.u32LR) : ); \
asm ("mrs %[data], spsr;" : [data] "=&r" (tCpuRegister.u32SPSR) : );
extern void CpuExceptionHandler();
void __attribute__((interrupt("UNDEF"), section(".text.hwi"), noinline)) __attribute((naked)) HwiP_undefined_handler_sew(void)
{
GET_CPUREGISTER;
asm ("mov %[data], 0;" : [data] "=&r" (tCpuRegister.u32ExceptionType) : );
asm ("bl CpuExceptionHandler;");
}
void __attribute__((interrupt("UNDEF"), section(".text.hwi"), noinline)) __attribute((naked)) HwiP_reserved_handler_sew(void)
{
GET_CPUREGISTER;
asm ("mov %[data], 1;" : [data] "=&r" (tCpuRegister.u32ExceptionType) : );
asm ("bl CpuExceptionHandler;");
}
void __attribute__((interrupt("ABORT"), section(".text.hwi"), noinline)) __attribute((naked)) HwiP_data_abort_handler_sew(void)
{
GET_CPUREGISTER;
asm ("mov %[data], 2;" : [data] "=&r" (tCpuRegister.u32ExceptionType) : );
asm ("bl CpuExceptionHandler;");
}
void __attribute__((interrupt("ABORT"), section(".text.hwi"), noinline)) __attribute((naked)) HwiP_prefetch_abort_handler_sew(void)
{
GET_CPUREGISTER;
asm ("mov %[data], 3;" : [data] "=&r" (tCpuRegister.u32ExceptionType) : );
asm ("bl CpuExceptionHandler;");
}
But after reading the corresponding CPU-Registers we don't get usefull exception information (at any time).
How can we access information about CPU-Registers, Stack-Pointer, Call-Stack, ...?
Regards,
Sven Hogenmüller
