Reused CPU peripheral for GPRs in AVR8 driver
This commit is contained in:
@@ -18,7 +18,7 @@ namespace DebugServer::Gdb::AvrGdb
|
||||
, eepromMemorySegmentDescriptor(this->eepromAddressSpaceDescriptor.getMemorySegmentDescriptor("internal_eeprom"))
|
||||
, sramMemorySegmentDescriptor(this->sramAddressSpaceDescriptor.getMemorySegmentDescriptor("internal_ram"))
|
||||
, gpRegistersMemorySegmentDescriptor(this->gpRegistersAddressSpaceDescriptor.getMemorySegmentDescriptor("gp_registers"))
|
||||
, cpuGpPeripheralDescriptor(targetDescriptor.getPeripheralDescriptor("cpu_gpr"))
|
||||
, cpuGpPeripheralDescriptor(targetDescriptor.getPeripheralDescriptor("cpu"))
|
||||
, cpuGpRegisterGroupDescriptor(this->cpuGpPeripheralDescriptor.getRegisterGroupDescriptor("gpr"))
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -280,24 +280,15 @@ namespace Targets::Microchip::Avr8
|
||||
const auto& registerFileAddressSpace = this->targetDescriptionFile.getRegisterFileAddressSpace();
|
||||
const auto& registerFileMemorySegment = registerFileAddressSpace.getMemorySegment("gp_registers");
|
||||
|
||||
auto& gpPeripheral = descriptor.peripheralDescriptorsByKey.emplace(
|
||||
"cpu_gpr",
|
||||
TargetPeripheralDescriptor{
|
||||
"cpu_gpr",
|
||||
"GPRs",
|
||||
"CPU General Purpose Registers",
|
||||
{},
|
||||
{}
|
||||
}
|
||||
).first->second;
|
||||
auto& cpuPeripheral = descriptor.getPeripheralDescriptor("cpu");
|
||||
|
||||
auto& gpRegisterGroup = gpPeripheral.registerGroupDescriptorsByKey.emplace(
|
||||
auto& gpRegisterGroup = cpuPeripheral.registerGroupDescriptorsByKey.emplace(
|
||||
"gpr",
|
||||
TargetRegisterGroupDescriptor{
|
||||
"gpr",
|
||||
"gpr",
|
||||
"CPU General Purpose",
|
||||
gpPeripheral.key,
|
||||
"GPR",
|
||||
cpuPeripheral.key,
|
||||
registerFileAddressSpace.key,
|
||||
std::nullopt,
|
||||
{},
|
||||
@@ -313,7 +304,7 @@ namespace Targets::Microchip::Avr8
|
||||
key,
|
||||
"R" + std::to_string(i),
|
||||
gpRegisterGroup.absoluteKey,
|
||||
gpPeripheral.key,
|
||||
cpuPeripheral.key,
|
||||
registerFileAddressSpace.key,
|
||||
registerFileMemorySegment.startAddress + i,
|
||||
1,
|
||||
|
||||
@@ -128,6 +128,12 @@ namespace Targets
|
||||
return descriptor->get();
|
||||
}
|
||||
|
||||
TargetPeripheralDescriptor& TargetDescriptor::getPeripheralDescriptor(const std::string& key) {
|
||||
return const_cast<TargetPeripheralDescriptor&>(
|
||||
const_cast<const TargetDescriptor*>(this)->getPeripheralDescriptor(key)
|
||||
);
|
||||
}
|
||||
|
||||
std::optional<
|
||||
std::reference_wrapper<const TargetPadDescriptor>
|
||||
> TargetDescriptor::tryGetPadDescriptor(const std::string& key) const {
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace Targets
|
||||
) const;
|
||||
|
||||
const TargetPeripheralDescriptor& getPeripheralDescriptor(const std::string& key) const;
|
||||
TargetPeripheralDescriptor& getPeripheralDescriptor(const std::string& key);
|
||||
|
||||
std::optional<std::reference_wrapper<const TargetPadDescriptor>> tryGetPadDescriptor(
|
||||
const std::string& key
|
||||
|
||||
Reference in New Issue
Block a user