- fixed dbg

- exception stacksize can be larger than 32kB
- debugger entry on ctrl-c inside debugger terminal

git-svn-id: http://moon:8086/svn/mips@78 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-14 14:27:03 +00:00
parent 543c87eefe
commit 6e59fe2263
5 changed files with 125 additions and 55 deletions
+42 -5
View File
@@ -5,8 +5,8 @@
*/
#include <stddef.h>
#include "board.h"
#include "../../regdef.h"
extern uart_if_t uart_if[];
@@ -26,6 +26,8 @@ con_if_t con_if =
con_if_entry, ARRAYSIZE(con_if_entry)
};
void dbg_uart_setup();
void board_init(void)
{
uint32_t volatile *pITIM_ctrl = (uint32_t*)SYS_ITIM_CTRL;
@@ -33,18 +35,53 @@ void board_init(void)
// Disable timers
*pITIM_ctrl = 0;
// Initialzie syscall support
// Setup syscall support
syscalls_init();
// Initialzie interrupt support
interrupt_init();
// Setup Uart ISR
dbg_uart_setup();
// Initalize debugger
// Setup debugger
dbg_init();
// Setup interrupt support
interrupt_init();
// Do some initializations here
}
extern void dbg_handler(struct xcptcontext * xcp);
void dbg_uart_isr(struct xcptcontext *xcp);
void dbg_uart_setup()
{
uart_if_t *pUart = (uart_if_t*)con_getInstanceByName("UART-1");
*pUart->pCTRL = SYS_UART_BIT_RX_INTEN;
interrupt_register(SYS_INT_UART1, dbg_uart_isr);
interrupt_enable(SYS_INT_UART1);
}
void dbg_uart_isr(struct xcptcontext *xcp)
{
uart_if_t *pUart = (uart_if_t*)con_getInstanceByName("UART-1");
if(SYS_UART_BIT_RX_AVAIL & *pUart->pCTRL)
{
char c = *pUart->pDATA;
if (c == 3)
{
// Disable UART interrupt
// to prevent consuming uart data in ISR during single step
// Interrupts mask bits are recovered on return from exception
//interrupt_disable(SYS_INT_UART1);
//uint32_t im = 1 << SYS_INT_UART1;
//xcp->sr &= ~(SR_MASK_IM & (im << 8));
//*pUart->pCTRL &= ~SYS_UART_BIT_RX_INTEN;
dbg_handler(xcp);
}
}
}
void dbg_putchar(char c)
{
writechar(4, c);