Line 39... |
Line 39... |
#include "RspConnection.h"
|
#include "RspConnection.h"
|
#include "MpHash.h"
|
#include "MpHash.h"
|
#include "RspPacket.h"
|
#include "RspPacket.h"
|
#include "DebugUnitSC.h"
|
#include "DebugUnitSC.h"
|
|
|
|
|
//! Module implementing a GDB RSP server.
|
//! Module implementing a GDB RSP server.
|
|
|
//! A thread listens for RSP requests, which are converted to requests to read
|
//! A thread listens for RSP requests, which are converted to requests to read
|
//! and write registers, memory or control the CPU in the debug unit
|
//! and write registers, memory or control the CPU in the debug unit
|
|
|
class GdbServerSC
|
class GdbServerSC:public sc_core::sc_module {
|
: public sc_core::sc_module
|
|
{
|
|
public:
|
public:
|
|
|
// Constructor and destructor
|
// Constructor and destructor
|
GdbServerSC (sc_core::sc_module_name name,
|
GdbServerSC (sc_core::sc_module_name name,
|
uint32_t _flashStart,
|
uint32_t _flashStart,
|
uint32_t _flashEnd,
|
uint32_t _flashEnd,
|
int rspPort,
|
int rspPort,
|
sc_core::sc_fifo<TapAction *> *tapActionQueue);
|
sc_core::sc_fifo < TapAction * >*tapActionQueue);
|
~GdbServerSC ();
|
~GdbServerSC ();
|
|
|
private:
|
private:
|
|
|
//! Definition of GDB target signals.
|
//! Definition of GDB target signals.
|
Line 134... |
Line 131... |
static const uint32_t SPR_DCR_CC_MASK = 0x0000000e; //!< Compare Condition
|
static const uint32_t SPR_DCR_CC_MASK = 0x0000000e; //!< Compare Condition
|
static const uint32_t SPR_DCR_SC_MASK = 0x00000010; //!< Signed Comparison
|
static const uint32_t SPR_DCR_SC_MASK = 0x00000010; //!< Signed Comparison
|
static const uint32_t SPR_DCR_CT_MASK = 0x000000e0; //!< Compare To
|
static const uint32_t SPR_DCR_CT_MASK = 0x000000e0; //!< Compare To
|
static const uint32_t SPR_DMR2_WGB_SHIFT = 12; //!< W/pt Generate B/pt
|
static const uint32_t SPR_DMR2_WGB_SHIFT = 12; //!< W/pt Generate B/pt
|
|
|
|
|
// DRR (Debug Reason Register) Bits
|
// DRR (Debug Reason Register) Bits
|
static const uint32_t SPR_DRR_RSTE = 0x00000001; //!< Reset
|
static const uint32_t SPR_DRR_RSTE = 0x00000001; //!< Reset
|
static const uint32_t SPR_DRR_BUSEE = 0x00000002; //!< Bus error
|
static const uint32_t SPR_DRR_BUSEE = 0x00000002; //!< Bus error
|
static const uint32_t SPR_DRR_DPFE = 0x00000004; //!< Data page fault
|
static const uint32_t SPR_DRR_DPFE = 0x00000004; //!< Data page fault
|
static const uint32_t SPR_DRR_IPFE = 0x00000008; //!< Insn page fault
|
static const uint32_t SPR_DRR_IPFE = 0x00000008; //!< Insn page fault
|
Line 191... |
Line 187... |
// Handle the various RSP requests
|
// Handle the various RSP requests
|
void rspCheckForException();
|
void rspCheckForException();
|
void rspReportException ();
|
void rspReportException ();
|
void rspContinue ();
|
void rspContinue ();
|
void rspContinue (uint32_t except);
|
void rspContinue (uint32_t except);
|
void rspContinue (uint32_t addr,
|
void rspContinue(uint32_t addr, uint32_t except);
|
uint32_t except);
|
|
void rspInterrupt ();
|
void rspInterrupt ();
|
void rspReadAllRegs ();
|
void rspReadAllRegs ();
|
void rspWriteAllRegs ();
|
void rspWriteAllRegs ();
|
void rspReadMem ();
|
void rspReadMem ();
|
void rspWriteMem ();
|
void rspWriteMem ();
|
Line 206... |
Line 201... |
void rspCommand ();
|
void rspCommand ();
|
void rspSet ();
|
void rspSet ();
|
void rspRestart ();
|
void rspRestart ();
|
void rspStep ();
|
void rspStep ();
|
void rspStep (uint32_t except);
|
void rspStep (uint32_t except);
|
void rspStep (uint32_t addr,
|
void rspStep(uint32_t addr, uint32_t except);
|
uint32_t except);
|
|
void rspVpkt ();
|
void rspVpkt ();
|
void rspWriteMemBin ();
|
void rspWriteMemBin ();
|
void rspRemoveMatchpoint ();
|
void rspRemoveMatchpoint ();
|
void rspInsertMatchpoint ();
|
void rspInsertMatchpoint ();
|
|
|
Line 219... |
Line 213... |
// SPRs.
|
// SPRs.
|
uint32_t readNpc ();
|
uint32_t readNpc ();
|
void writeNpc (uint32_t addr);
|
void writeNpc (uint32_t addr);
|
|
|
uint32_t readGpr (int regNum);
|
uint32_t readGpr (int regNum);
|
void writeGpr (int regNum,
|
void writeGpr(int regNum, uint32_t value);
|
uint32_t value);
|
|
|
|
// Check if we got a message from the or1200 monitor module telling us
|
// Check if we got a message from the or1200 monitor module telling us
|
// to stall
|
// to stall
|
bool checkMonitorPipe ();
|
bool checkMonitorPipe ();
|
|
|