- refactored debugger setup from <BOARD_NAME>board to debugger

git-svn-id: http://moon:8086/svn/mips@186 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2021-11-22 16:34:56 +00:00
parent 34bd764372
commit 026b7c322e
3 changed files with 10 additions and 89 deletions
+2 -60
View File
@@ -6,36 +6,13 @@
#include <stddef.h>
#include "board.h"
#include "../debugger.h"
#include "../../irq.h"
#include "../../uart.h"
#include "../../console.h"
#include "../../asm/regdef.h"
#include "../../syscalls.h"
#ifdef WITH_ROM_DEBUGGER
const fp_xcpt_t dbg_func = (fp_xcpt_t)0xbfc01fc0;
#else
#ifdef WITH_GDB_STUB
extern void handle_exception (unsigned long *registers);
#else
extern int dbg_handler(struct xcptcontext * xcp);
#endif
int dbg_stub(struct xcptcontext * xcp) __attribute__ ((section (".dbg_stub"))) __attribute__ ((used));
int dbg_stub(struct xcptcontext * xcp)
{
#ifdef WITH_GDB_STUB
handle_exception((unsigned long *)xcp);
return 0;
#else
return dbg_handler(xcp);
#endif
}
const fp_xcpt_t dbg_func = (fp_xcpt_t)dbg_stub;
#endif
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
// ---------------------------------------------------------------------------------
@@ -64,38 +41,6 @@ const con_if_t con_if =
con_if_entry, ARRAYSIZE(con_if_entry)
};
void dbg_uart_isr(struct xcptcontext *xcp)
{
if(SYS_UART_BIT_RX_AVAIL & *uart_if[UART_DEBUGGER].pCTRL)
{
char c = *uart_if[UART_DEBUGGER].pDATA;
if (c == 3)
{
dbg_func(xcp);
}
}
}
void dbg_uart_setup()
{
const#include "../../syscalls.h" int UART_INT = SYS_INT_UART1;
*uart_if[UART_DEBUGGER].pCTRL = SYS_UART_BIT_RX_INTEN;
interrupt_register(UART_INT, dbg_uart_isr);
interrupt_enable(UART_INT);
}
void dbg_init()
{
xcpt_register(EXC_ADEL, dbg_func);
xcpt_register(EXC_ADES, dbg_func);
xcpt_register(EXC_IBE, dbg_func);
xcpt_register(EXC_DBE, dbg_func);
xcpt_register(EXC_BP, dbg_func);
xcpt_register(EXC_RI, dbg_func);
xcpt_register(EXC_CPU, dbg_func);
xcpt_register(EXC_OV, dbg_func);
}
void board_init(void)
{
uint32_t volatile *pITIM_ctrl = (uint32_t*)SYS_ITIM_CTRL;
@@ -109,11 +54,8 @@ void board_init(void)
// Setup syscall support
syscalls_init();
// Setup Uart ISR
dbg_uart_setup();
// Setup debugger
dbg_init();
debugger_init();
// Setup interrupt support
interrupt_init();