Support for hardware breakpoints
This commit is contained in:
@@ -268,6 +268,7 @@ namespace Targets::Microchip::Avr::Avr8Bit
|
||||
"Microchip",
|
||||
this->targetMemoryDescriptorsByType,
|
||||
this->targetRegisterDescriptorsById,
|
||||
this->getBreakpointResources(),
|
||||
{},
|
||||
Targets::TargetMemoryType::FLASH
|
||||
);
|
||||
@@ -304,12 +305,20 @@ namespace Targets::Microchip::Avr::Avr8Bit
|
||||
this->avr8DebugInterface->reset();
|
||||
}
|
||||
|
||||
void Avr8::setBreakpoint(std::uint32_t address) {
|
||||
this->avr8DebugInterface->setBreakpoint(address);
|
||||
void Avr8::setSoftwareBreakpoint(TargetMemoryAddress address) {
|
||||
this->avr8DebugInterface->setSoftwareBreakpoint(address);
|
||||
}
|
||||
|
||||
void Avr8::removeBreakpoint(std::uint32_t address) {
|
||||
this->avr8DebugInterface->clearBreakpoint(address);
|
||||
void Avr8::removeSoftwareBreakpoint(TargetMemoryAddress address) {
|
||||
this->avr8DebugInterface->clearSoftwareBreakpoint(address);
|
||||
}
|
||||
|
||||
void Avr8::setHardwareBreakpoint(TargetMemoryAddress address) {
|
||||
this->avr8DebugInterface->setHardwareBreakpoint(address);
|
||||
}
|
||||
|
||||
void Avr8::removeHardwareBreakpoint(TargetMemoryAddress address) {
|
||||
this->avr8DebugInterface->clearHardwareBreakpoint(address);
|
||||
}
|
||||
|
||||
void Avr8::clearAllBreakpoints() {
|
||||
@@ -687,6 +696,33 @@ namespace Targets::Microchip::Avr::Avr8Bit
|
||||
}
|
||||
}
|
||||
|
||||
BreakpointResources Avr8::getBreakpointResources() {
|
||||
auto maxHardwareBreakpoints = 0;
|
||||
|
||||
switch (this->targetConfig.physicalInterface) {
|
||||
case PhysicalInterface::JTAG: {
|
||||
maxHardwareBreakpoints = this->family == Family::XMEGA ? 2 : 3;
|
||||
break;
|
||||
}
|
||||
case PhysicalInterface::PDI: {
|
||||
maxHardwareBreakpoints = 2;
|
||||
break;
|
||||
}
|
||||
case PhysicalInterface::UPDI: {
|
||||
maxHardwareBreakpoints = 1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return BreakpointResources(
|
||||
maxHardwareBreakpoints,
|
||||
std::nullopt
|
||||
);
|
||||
}
|
||||
|
||||
bool Avr8::isFuseEnabled(const FuseBitsDescriptor& descriptor, unsigned char fuseByteValue) const {
|
||||
const auto programmedValue = static_cast<unsigned char>(
|
||||
this->fuseEnableStrategy == FuseEnableStrategy::SET
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "src/Targets/Microchip/AVR/Fuse.hpp"
|
||||
#include "src/Targets/TargetRegister.hpp"
|
||||
#include "src/Targets/TargetBreakpoint.hpp"
|
||||
|
||||
#include "TargetDescription/TargetDescriptionFile.hpp"
|
||||
|
||||
@@ -58,8 +59,11 @@ namespace Targets::Microchip::Avr::Avr8Bit
|
||||
void step() override;
|
||||
void reset() override;
|
||||
|
||||
void setBreakpoint(TargetProgramCounter address) override;
|
||||
void removeBreakpoint(TargetProgramCounter address) override;
|
||||
void setSoftwareBreakpoint(TargetProgramCounter address) override;
|
||||
void removeSoftwareBreakpoint(TargetProgramCounter address) override;
|
||||
|
||||
void setHardwareBreakpoint(TargetProgramCounter address) override;
|
||||
void removeHardwareBreakpoint(TargetProgramCounter address) override;
|
||||
void clearAllBreakpoints() override;
|
||||
|
||||
void writeRegisters(TargetRegisters registers) override;
|
||||
@@ -143,6 +147,8 @@ namespace Targets::Microchip::Avr::Avr8Bit
|
||||
|
||||
void loadTargetMemoryDescriptors();
|
||||
|
||||
BreakpointResources getBreakpointResources();
|
||||
|
||||
/**
|
||||
* Checks if a particular fuse is enabled in the given fuse byte value. Takes the target's fuse enable strategy
|
||||
* into account.
|
||||
|
||||
Reference in New Issue
Block a user