Dump PC in assert failure
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#ifndef BSP_PINE64_PINS_H_
|
||||
#define BSP_PINE64_PINS_H_
|
||||
#include "bl702_adc.h"
|
||||
#include "bl702_pwm.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
#define KEY_B_Pin GPIO_PIN_28
|
||||
|
||||
@@ -159,12 +159,3 @@ void setupFUSBIRQ() {
|
||||
CPU_Interrupt_Enable(GPIO_INT0_IRQn);
|
||||
gpio_irq_enable(FUSB302_IRQ_Pin, ENABLE);
|
||||
}
|
||||
|
||||
void vAssertCalled(void) {
|
||||
MSG((char *)"vAssertCalled\r\n");
|
||||
PWM_Channel_Disable(PWM_Channel);
|
||||
gpio_set_mode(PWM_Out_Pin, GPIO_INPUT_PD_MODE);
|
||||
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -221,6 +221,7 @@
|
||||
#define rdtime() read_csr(time)
|
||||
#define rdcycle() read_csr(cycle)
|
||||
#define rdinstret() read_csr(instret)
|
||||
#define get_pc() read_csr(mepc)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -173,6 +173,21 @@ const pFunc __Vectors[] __attribute__((section(".init"), aligned(64))) = {
|
||||
WIFI_IPC_PUBLIC_IRQHandler_Wrapper, /* 16 + 63 */
|
||||
};
|
||||
|
||||
#include "riscv_encoding.h"
|
||||
void vAssertCalled(void) {
|
||||
MSG((char *)"vAssertCalled\r\n");
|
||||
unsigned long epc;
|
||||
epc = get_pc();
|
||||
MSG("mepc:0x%08x\r\n", (uint32_t)epc);
|
||||
|
||||
// PWM_Channel_Disable(PWM_Channel);
|
||||
// gpio_set_mode(PWM_Out_Pin, GPIO_INPUT_PD_MODE);
|
||||
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
void Trap_Handler(void)
|
||||
{
|
||||
unsigned long cause;
|
||||
@@ -184,7 +199,7 @@ void Trap_Handler(void)
|
||||
|
||||
cause = read_csr(mcause);
|
||||
MSG("mcause=%08x\r\n", (uint32_t)cause);
|
||||
epc = read_csr(mepc);
|
||||
epc = get_pc();
|
||||
MSG("mepc:%08x\r\n", (uint32_t)epc);
|
||||
tval = read_csr(mtval);
|
||||
MSG("mtval:%08x\r\n", (uint32_t)tval);
|
||||
|
||||
Reference in New Issue
Block a user