- bootloader build with LTO

- switch between debugger from rom or from app
- gdb_stub: added debug output to stdout

git-svn-id: http://moon:8086/svn/mips@104 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-19 18:03:53 +00:00
parent cfef553c9c
commit f3e297c9e6
6 changed files with 102 additions and 35 deletions
+36 -5
View File
@@ -11,9 +11,19 @@
#include "../../console.h"
#include "../../regdef.h"
const fp_xcpt_t dbg_func = (fp_xcpt_t)0xbfc01f00;
extern uart_if_t uart_if[];
extern void handle_exception (unsigned long *registers);
int gdb_stub(struct xcptcontext * xcp)
{
handle_exception((unsigned long *)xcp);
return 0;
}
#ifdef WITH_ROM_GDBSTUB
const fp_xcpt_t dbg_func = (fp_xcpt_t)0xbfc01f00;
#else
const fp_xcpt_t dbg_func = (fp_xcpt_t)gdb_stub;
#endif
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
@@ -48,9 +58,7 @@ void dbg_uart_isr(struct xcptcontext *xcp)
void dbg_uart_setup()
{
const int UART_INT = SYS_INT_UART1;
dbg_uart = (uart_if_t*)con_getInterfaceByName("UART-1")->pInst;
*dbg_uart->pCTRL = SYS_UART_BIT_RX_INTEN;
*uart_if[UART_DEBUGGER].pCTRL = SYS_UART_BIT_RX_INTEN;
interrupt_register(UART_INT, dbg_uart_isr);
interrupt_enable(UART_INT);
}
@@ -88,3 +96,26 @@ void board_init(void)
// Do some initializations here
}
void dbg_putchar(char c)
{
if (c == 0x0A)
{
UART_writechar(&uart_if[UART_DEBUGGER], 0x0D);
}
UART_writechar(&uart_if[UART_DEBUGGER], c);
}
char dbg_getchar()
{
int c;
// busy read
do
{
c = UART_readchar(&uart_if[UART_DEBUGGER]);
} while(c < 0);
return (char)c;
}