From c88dc35e4bcc02b7eb1e210a9a52350d86e65720 Mon Sep 17 00:00:00 2001 From: Nav Date: Mon, 8 May 2023 13:04:26 +0100 Subject: [PATCH] Included target ID verification in OCDEN fuse bit management --- src/Targets/Microchip/AVR/AVR8/Avr8.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Targets/Microchip/AVR/AVR8/Avr8.cpp b/src/Targets/Microchip/AVR/AVR8/Avr8.cpp index bb7f732e..206adad9 100644 --- a/src/Targets/Microchip/AVR/AVR8/Avr8.cpp +++ b/src/Targets/Microchip/AVR/AVR8/Avr8.cpp @@ -1002,6 +1002,18 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit ); } + const auto targetSignature = this->avr8DebugInterface->getDeviceId(); + const auto tdSignature = this->targetDescriptionFile->getTargetSignature(); + + if (targetSignature != tdSignature) { + throw Exception( + "Failed to validate connected target - target signature mismatch.\nThe target signature" + " (\"" + targetSignature.toHex() + "\") does not match the AVR8 target description signature (\"" + + tdSignature.toHex() + "\"). This will likely be due to an incorrect target name in the " + + "configuration file (bloom.yaml)." + ); + } + const auto ocdenFuseBitsDescriptor = this->targetDescriptionFile->getOcdenFuseBitsDescriptor(); const auto jtagenFuseBitsDescriptor = this->targetDescriptionFile->getJtagenFuseBitsDescriptor();