- added debugger
This commit is contained in:
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../irq.h"
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------
|
||||||
|
// Debugger
|
||||||
|
// ---------------------------------------------------------------------------------
|
||||||
|
#ifdef WITH_ROM_DEBUGGER
|
||||||
|
const fp_xcpt_t dbg_func = (fp_xcpt_t)0xbfc01fc0;
|
||||||
|
#else
|
||||||
|
extern int dbg_handler(struct xcptcontext * xcp);
|
||||||
|
const fp_xcpt_t dbg_xcpt_func = (fp_xcpt_t)dbg_handler;
|
||||||
|
void dbg_irq_func(struct xcptcontext * xcp)
|
||||||
|
{
|
||||||
|
// Ignore return value
|
||||||
|
dbg_xcpt_func(xcp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_DEBUGGER_INVOKE_UART
|
||||||
|
void __debugger_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 debugger_uart_setup()
|
||||||
|
{
|
||||||
|
const int UART_INT = SYS_INT_UART1;
|
||||||
|
*uart_if[UART_DEBUGGER].pCTRL = SYS_UART_BIT_RX_INTEN;
|
||||||
|
interrupt_register(UART_INT, __debugger_uart_isr);
|
||||||
|
interrupt_enable(UART_INT);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void debugger_button_setup()
|
||||||
|
{
|
||||||
|
interrupt_register(2, dbg_irq_func);
|
||||||
|
interrupt_enable(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void debugger_init()
|
||||||
|
{
|
||||||
|
#ifdef WITH_DEBUGGER_INVOKE_UART
|
||||||
|
debugger_uart_setup();
|
||||||
|
#else
|
||||||
|
debugger_button_setup();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
xcpt_register(EXC_ADEL, dbg_xcpt_func);
|
||||||
|
xcpt_register(EXC_ADES, dbg_xcpt_func);
|
||||||
|
xcpt_register(EXC_IBE, dbg_xcpt_func);
|
||||||
|
xcpt_register(EXC_DBE, dbg_xcpt_func);
|
||||||
|
xcpt_register(EXC_BP, dbg_xcpt_func);
|
||||||
|
xcpt_register(EXC_RI, dbg_xcpt_func);
|
||||||
|
xcpt_register(EXC_CPU, dbg_xcpt_func);
|
||||||
|
xcpt_register(EXC_OV, dbg_xcpt_func);
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File: debugger.h
|
||||||
|
* Author: jens
|
||||||
|
*
|
||||||
|
* Created on 22. November 2021, 16:58
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOARDS_DEBUGGER_H
|
||||||
|
#define BOARDS_DEBUGGER_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void debugger_init();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* BOARDS_DEBUGGER_H */
|
||||||
|
|
||||||
Reference in New Issue
Block a user