Added default JTAG debug clock and JTAG daisy chain parameters

This commit is contained in:
Nav
2021-04-27 22:11:17 +01:00
parent 2e0bf9eb24
commit 9e7ca25762
2 changed files with 15 additions and 5 deletions

View File

@@ -19,6 +19,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
constexpr static Avr8EdbgParameter PHYSICAL_INTERFACE {0x01, 0x00};
constexpr static Avr8EdbgParameter DW_CLOCK_DIVISION_FACTOR {0x01, 0x10};
constexpr static Avr8EdbgParameter XMEGA_PDI_CLOCK {0x01, 0x31};
constexpr static Avr8EdbgParameter MEGA_DEBUG_CLOCK {0x01, 0x21};
constexpr static Avr8EdbgParameter JTAG_DAISY_CHAIN_SETTINGS {0x01, 0x01};
// debugWire and JTAG parameters
constexpr static Avr8EdbgParameter DEVICE_BOOT_START_ADDR {0x02, 0x0A};

View File

@@ -84,11 +84,6 @@ void EdbgAvr8Interface::configure(const TargetConfig& targetConfig) {
this->physicalInterface = selectedPhysicalInterface;
this->configVariant = availableConfigVariants.find(selectedPhysicalInterface)->second;
if (this->configVariant == Avr8ConfigVariant::XMEGA) {
// Default PDI clock to 4MHz
this->setParameter(Avr8EdbgParameters::XMEGA_PDI_CLOCK, static_cast<std::uint16_t>(0x0FA0));
}
}
void EdbgAvr8Interface::setTargetParameters(const Avr8Bit::TargetParameters& config) {
@@ -288,6 +283,19 @@ void EdbgAvr8Interface::setTargetParameters(const Avr8Bit::TargetParameters& con
}
void EdbgAvr8Interface::init() {
if (this->configVariant == Avr8ConfigVariant::XMEGA) {
// Default PDI clock to 4MHz
// TODO: Make this adjustable via a target config parameter
this->setParameter(Avr8EdbgParameters::XMEGA_PDI_CLOCK, static_cast<std::uint16_t>(0x0FA0));
}
if (this->configVariant == Avr8ConfigVariant::MEGAJTAG) {
// Default clock value for mega debugging is 2KHz
// TODO: Make this adjustable via a target config parameter
this->setParameter(Avr8EdbgParameters::MEGA_DEBUG_CLOCK, static_cast<std::uint16_t>(0x00C8));
this->setParameter(Avr8EdbgParameters::JTAG_DAISY_CHAIN_SETTINGS, static_cast<std::uint32_t>(0));
}
this->setParameter(
Avr8EdbgParameters::CONFIG_VARIANT,
static_cast<unsigned char>(this->configVariant)