Lots of tidying

- Removed generic `avr8` target
- Simplified AVR8 target construction
- Introduced register descriptor IDs
- Simplified GDB register mappings
- Simplified target interface contract
- Other bits of tidying
This commit is contained in:
Nav
2023-05-21 21:08:25 +01:00
parent 5f8242a87a
commit ba03833325
62 changed files with 1304 additions and 1577 deletions

View File

@@ -66,7 +66,6 @@ namespace Bloom::DebugToolDrivers
);
}
this->edbgAvr8Interface = std::make_unique<EdbgAvr8Interface>(this->edbgInterface.get());
this->edbgAvrIspInterface = std::make_unique<EdbgAvrIspInterface>(this->edbgInterface.get());
this->setInitialised(true);
@@ -81,6 +80,27 @@ namespace Bloom::DebugToolDrivers
UsbDevice::close();
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* EdbgDevice::getAvr8DebugInterface(
const Targets::Microchip::Avr::Avr8Bit::Avr8TargetConfig& targetConfig,
Targets::Microchip::Avr::Avr8Bit::Family targetFamily,
const Targets::Microchip::Avr::Avr8Bit::TargetParameters& targetParameters,
const Targets::TargetRegisterDescriptorMapping& targetRegisterDescriptorsById
) {
if (this->edbgAvr8Interface == nullptr) {
this->edbgAvr8Interface = std::make_unique<EdbgAvr8Interface>(
this->edbgInterface.get(),
targetConfig,
targetFamily,
targetParameters,
targetRegisterDescriptorsById
);
this->configureAvr8Interface();
}
return this->edbgAvr8Interface.get();
}
std::string EdbgDevice::getSerialNumber() {
using namespace CommandFrames::Discovery;
using ResponseFrames::Discovery::ResponseId;

View File

@@ -50,11 +50,16 @@ namespace Bloom::DebugToolDrivers
*/
void close() override;
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
return this->edbgAvr8Interface.get();
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface(
const Targets::Microchip::Avr::Avr8Bit::Avr8TargetConfig& targetConfig,
Targets::Microchip::Avr::Avr8Bit::Family targetFamily,
const Targets::Microchip::Avr::Avr8Bit::TargetParameters& targetParameters,
const Targets::TargetRegisterDescriptorMapping& targetRegisterDescriptorsById
) override;
TargetInterfaces::Microchip::Avr::AvrIspInterface* getAvrIspInterface() override {
TargetInterfaces::Microchip::Avr::AvrIspInterface* getAvrIspInterface(
const Targets::Microchip::Avr::Avr8Bit::Avr8TargetConfig& targetConfig
) override {
return this->edbgAvrIspInterface.get();
}
@@ -153,5 +158,9 @@ namespace Bloom::DebugToolDrivers
* @return
*/
std::uint16_t getCmsisHidReportSize();
virtual void configureAvr8Interface() {
return;
}
};
}

View File

@@ -18,7 +18,6 @@ namespace Bloom::DebugToolDrivers
try {
EdbgDevice::init();
this->edbgAvr8Interface->setReactivateJtagTargetPostProgrammingMode(true);
} catch (const DeviceNotFound& exception) {
/*
@@ -40,4 +39,8 @@ namespace Bloom::DebugToolDrivers
throw exception;
}
}
void MplabPickit4::configureAvr8Interface() {
this->edbgAvr8Interface->setReactivateJtagTargetPostProgrammingMode(true);
}
}

View File

@@ -36,5 +36,8 @@ namespace Bloom::DebugToolDrivers
}
void init() override;
protected:
void configureAvr8Interface() override;
};
}

View File

@@ -18,7 +18,6 @@ namespace Bloom::DebugToolDrivers
try {
EdbgDevice::init();
this->edbgAvr8Interface->setReactivateJtagTargetPostProgrammingMode(true);
} catch (const DeviceNotFound& exception) {
/*
@@ -48,4 +47,8 @@ namespace Bloom::DebugToolDrivers
throw exception;
}
}
void MplabSnap::configureAvr8Interface() {
this->edbgAvr8Interface->setReactivateJtagTargetPostProgrammingMode(true);
}
}

View File

@@ -39,5 +39,8 @@ namespace Bloom::DebugToolDrivers
}
void init() override;
protected:
void configureAvr8Interface() override;
};
}

View File

@@ -11,9 +11,7 @@ namespace Bloom::DebugToolDrivers
)
{}
void XplainedPro::init() {
EdbgDevice::init();
void XplainedPro::configureAvr8Interface() {
this->edbgAvr8Interface->setMaximumMemoryAccessSizePerRequest(256);
}
}

View File

@@ -27,6 +27,7 @@ namespace Bloom::DebugToolDrivers
return "Xplained Pro";
}
void init() override;
protected:
void configureAvr8Interface() override;
};
}