From 6aca0731b236eb7c2ba519ffafc5220d9ef7be50 Mon Sep 17 00:00:00 2001 From: Nav Date: Fri, 26 May 2023 22:42:48 +0100 Subject: [PATCH] Extract EESAVE fuse bit descriptor from AVR8 TDF --- .../AVR/AVR8/TargetDescription/TargetDescriptionFile.cpp | 4 ++++ .../AVR/AVR8/TargetDescription/TargetDescriptionFile.hpp | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.cpp b/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.cpp index 1dd0dbf2..863a2eaf 100644 --- a/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.cpp +++ b/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.cpp @@ -381,6 +381,10 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription return this->getFuseBitsDescriptorByName("jtagen"); } + std::optional TargetDescriptionFile::getEesaveFuseBitsDescriptor() const { + return this->getFuseBitsDescriptorByName("eesave"); + } + void TargetDescriptionFile::loadSupportedPhysicalInterfaces() { auto interfaceNamesToInterfaces = std::map({ {"updi", PhysicalInterface::UPDI}, diff --git a/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.hpp b/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.hpp index 4d1f3463..ef4769a0 100644 --- a/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.hpp +++ b/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.hpp @@ -127,6 +127,15 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription */ [[nodiscard]] std::optional getJtagenFuseBitsDescriptor() const; + /** + * Constructs a FuseBitDescriptor for the "Preserve EEPROM" (EESAVE) fuse bit, with information extracted from + * the TDF. + * + * @return + * std::nullopt if the EESAVE bit field could not be found in the TDF. + */ + [[nodiscard]] std::optional getEesaveFuseBitsDescriptor() const; + /** * Returns a set of all supported physical interfaces for debugging. *