From 066c7a469f0a4b3744c4739337782b12a95ff40e Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 5 Mar 2022 18:02:11 +0000 Subject: [PATCH] New AVR8 target config parameter ("updateDwenFuseBitOnDebugWireFailure") --- src/Targets/Microchip/AVR/AVR8/Avr8.cpp | 16 ++++++++++++++++ src/Targets/Microchip/AVR/AVR8/Avr8.hpp | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/Targets/Microchip/AVR/AVR8/Avr8.cpp b/src/Targets/Microchip/AVR/AVR8/Avr8.cpp index a58f50a7..1342c499 100644 --- a/src/Targets/Microchip/AVR/AVR8/Avr8.cpp +++ b/src/Targets/Microchip/AVR/AVR8/Avr8.cpp @@ -63,6 +63,22 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit } } + if (targetConfig.jsonObject.contains("updateDwenFuseBitOnDebugWireFailure")) { + this->updateDwenFuseBitOnDebugWireFailure = targetConfig.jsonObject.value( + "updateDwenFuseBitOnDebugWireFailure" + ).toBool(); + + if (this->updateDwenFuseBitOnDebugWireFailure + && this->avrIspInterface == nullptr + && this->physicalInterface == PhysicalInterface::DEBUG_WIRE + ) { + Logger::warning( + "The connected debug tool (or associated driver) does not provide any ISP interface. " + "Bloom will be unable to update the DWEN fuse bit in the event of a debugWire activation failure." + ); + } + } + this->avr8DebugInterface->configure(targetConfig); if (this->avrIspInterface != nullptr) { diff --git a/src/Targets/Microchip/AVR/AVR8/Avr8.hpp b/src/Targets/Microchip/AVR/AVR8/Avr8.hpp index d886bd9c..ed661fe5 100644 --- a/src/Targets/Microchip/AVR/AVR8/Avr8.hpp +++ b/src/Targets/Microchip/AVR/AVR8/Avr8.hpp @@ -136,6 +136,8 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit std::map targetRegisterDescriptorsByType; std::map targetMemoryDescriptorsByType; + bool updateDwenFuseBitOnDebugWireFailure = false; + /** * Users are required to set their desired physical interface in their Bloom configuration. This would take * the form of a string, so we map the available options to the appropriate enums. @@ -151,6 +153,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit {"updi", PhysicalInterface::UPDI}, }); }; + /** * Resolves the appropriate TDF for the AVR8 target and populates this->targetDescriptionFile. */