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