diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVRISP/ProgramFuse.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVRISP/ProgramFuse.hpp index 468615d3..d7394cc4 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVRISP/ProgramFuse.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVRISP/ProgramFuse.hpp @@ -53,6 +53,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames this->payload[3] = 0x00; break; } + default: { + throw Exceptions::Exception("Unsupported fuse type"); + } } } }; diff --git a/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.cpp b/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.cpp index 0ad7f4b0..1dd0dbf2 100644 --- a/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.cpp +++ b/src/Targets/Microchip/AVR/AVR8/TargetDescription/TargetDescriptionFile.cpp @@ -685,20 +685,15 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription {"extended", FuseType::EXTENDED}, }); - for (const auto& [fuseTypeName, fuse] : fuseRegisterGroup.registersMappedByName) { - const auto fuseTypeIt = fuseTypesByName.find(fuseTypeName); - if (fuseTypeIt == fuseTypesByName.end()) { - // Unknown fuse type name - continue; - } - const auto fuseBitFieldIt = fuse.bitFieldsMappedByName.find(fuseBitName); if (fuseBitFieldIt != fuse.bitFieldsMappedByName.end()) { + const auto fuseTypeIt = fuseTypesByName.find(fuseTypeName); + return FuseBitsDescriptor( fuseAddressOffset + fuse.offset, - fuseTypeIt->second, + fuseTypeIt != fuseTypesByName.end() ? fuseTypeIt->second : FuseType::OTHER, fuseBitFieldIt->second.mask ); } diff --git a/src/Targets/Microchip/AVR/Fuse.hpp b/src/Targets/Microchip/AVR/Fuse.hpp index 901e483c..d6ecb59e 100644 --- a/src/Targets/Microchip/AVR/Fuse.hpp +++ b/src/Targets/Microchip/AVR/Fuse.hpp @@ -11,6 +11,7 @@ namespace Bloom::Targets::Microchip::Avr LOW, HIGH, EXTENDED, + OTHER, }; enum class FuseEnableStrategy: std::uint8_t