2023-11-21 21:40:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
2024-07-23 21:14:22 +01:00
|
|
|
#include <set>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <optional>
|
2023-11-21 21:40:40 +00:00
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
#include "src/Targets/TargetDescriptor.hpp"
|
|
|
|
|
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
|
|
|
|
|
#include "src/Targets/TargetMemorySegmentDescriptor.hpp"
|
|
|
|
|
#include "src/Targets/TargetState.hpp"
|
|
|
|
|
#include "src/Targets/TargetRegisterDescriptor.hpp"
|
|
|
|
|
#include "src/Targets/TargetMemory.hpp"
|
2025-01-28 00:14:04 +00:00
|
|
|
#include "src/Targets/TargetMemoryAddressRange.hpp"
|
2024-12-05 23:09:01 +00:00
|
|
|
#include "src/Targets/TargetBreakpoint.hpp"
|
2023-11-21 21:40:40 +00:00
|
|
|
|
|
|
|
|
namespace DebugToolDrivers::TargetInterfaces::RiscV
|
|
|
|
|
{
|
|
|
|
|
class RiscVDebugInterface
|
|
|
|
|
{
|
|
|
|
|
public:
|
2024-07-23 21:14:22 +01:00
|
|
|
virtual void activate() = 0;
|
|
|
|
|
virtual void deactivate() = 0;
|
2023-11-21 21:40:40 +00:00
|
|
|
|
2024-11-24 19:32:00 +00:00
|
|
|
virtual std::string getDeviceId() = 0;
|
|
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
virtual Targets::TargetExecutionState getExecutionState() = 0;
|
2023-11-21 21:40:40 +00:00
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
virtual void stop() = 0;
|
|
|
|
|
virtual void run() = 0;
|
|
|
|
|
virtual void step() = 0;
|
|
|
|
|
virtual void reset() = 0;
|
2023-11-21 21:40:40 +00:00
|
|
|
|
2024-12-05 23:09:01 +00:00
|
|
|
virtual Targets::BreakpointResources getBreakpointResources() = 0;
|
|
|
|
|
virtual void setProgramBreakpoint(const Targets::TargetProgramBreakpoint& breakpoint) = 0;
|
|
|
|
|
virtual void removeProgramBreakpoint(const Targets::TargetProgramBreakpoint& breakpoint) = 0;
|
2023-11-21 21:40:40 +00:00
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
virtual Targets::TargetRegisterDescriptorAndValuePairs readCpuRegisters(
|
|
|
|
|
const Targets::TargetRegisterDescriptors& descriptors
|
2023-11-21 21:40:40 +00:00
|
|
|
) = 0;
|
2024-07-23 21:14:22 +01:00
|
|
|
virtual void writeCpuRegisters(const Targets::TargetRegisterDescriptorAndValuePairs& registers) = 0;
|
|
|
|
|
|
|
|
|
|
virtual Targets::TargetMemoryBuffer readMemory(
|
|
|
|
|
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
|
|
|
|
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
|
|
|
|
|
Targets::TargetMemoryAddress startAddress,
|
|
|
|
|
Targets::TargetMemorySize bytes,
|
|
|
|
|
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
|
|
|
|
|
) = 0;
|
|
|
|
|
virtual void writeMemory(
|
|
|
|
|
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
|
|
|
|
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
|
|
|
|
|
Targets::TargetMemoryAddress startAddress,
|
2024-11-16 21:49:49 +00:00
|
|
|
Targets::TargetMemoryBufferSpan buffer
|
2023-11-21 21:40:40 +00:00
|
|
|
) = 0;
|
2024-11-24 19:32:00 +00:00
|
|
|
virtual void eraseMemory(
|
|
|
|
|
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
|
|
|
|
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor
|
|
|
|
|
) = 0;
|
2024-12-05 23:09:01 +00:00
|
|
|
|
|
|
|
|
virtual void enableProgrammingMode() = 0;
|
|
|
|
|
virtual void disableProgrammingMode() = 0;
|
2024-12-07 16:43:16 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The debug interface may have its own access restrictions for memory segments and registers. These member
|
|
|
|
|
* functions should adjust the access members of the given segment/register descriptor, to apply any additional
|
|
|
|
|
* access restrictions.
|
|
|
|
|
*
|
|
|
|
|
* The member functions are called as part of the construction of the RISC-V target descriptor.
|
|
|
|
|
*/
|
|
|
|
|
virtual void applyAccessRestrictions(Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor) = 0;
|
|
|
|
|
virtual void applyAccessRestrictions(Targets::TargetRegisterDescriptor& registerDescriptor) = 0;
|
2023-11-21 21:40:40 +00:00
|
|
|
};
|
|
|
|
|
}
|