diff --git a/src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp b/src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp index 8a885cbe..f7b1c2d7 100644 --- a/src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp +++ b/src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp @@ -22,13 +22,13 @@ void AtmelIce::init() { usbHidInterface.init(); } - /** + /* * The Atmel-ICE EDBG/CMSIS-DAP interface doesn't operate properly when sending commands too quickly. * * Because of this, we have to enforce a minimum time gap between commands. See comment * in CmsisDapInterface class declaration for more info. */ - this->getEdbgInterface().setMinimumCommandTimeGap(35); + this->getEdbgInterface().setMinimumCommandTimeGap(std::chrono::milliseconds(35)); // We don't need to claim the CMSISDAP interface here as the HIDAPI will have already done so. if (!this->sessionStarted) { diff --git a/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp b/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp index 0927fb8b..9339d55e 100644 --- a/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp +++ b/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp @@ -20,7 +20,7 @@ void MplabSnap::init() { usbHidInterface.init(); } - this->getEdbgInterface().setMinimumCommandTimeGap(35); + this->getEdbgInterface().setMinimumCommandTimeGap(std::chrono::milliseconds(35)); // We don't need to claim the CMSISDAP interface here as the HIDAPI will have already done so. if (!this->sessionStarted) { diff --git a/src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp b/src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp index 861b91c5..7b4f6d0c 100644 --- a/src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp +++ b/src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp @@ -22,13 +22,13 @@ void PowerDebugger::init() { usbHidInterface.init(); } - /** + /* * The Power Debugger EDBG/CMSIS-DAP interface doesn't operate properly when sending commands too quickly. * * Because of this, we have to enforce a minimum time gap between commands. See comment in * CmsisDapInterface class declaration for more info. */ - this->getEdbgInterface().setMinimumCommandTimeGap(35); + this->getEdbgInterface().setMinimumCommandTimeGap(std::chrono::milliseconds(35)); // We don't need to claim the CMSISDAP interface here as the HIDAPI will have already done so. if (!this->sessionStarted) { diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.cpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.cpp index 05999986..f89efbac 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.cpp @@ -11,13 +11,13 @@ using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap; using namespace Bloom::Exceptions; void CmsisDapInterface::sendCommand(const Command& cmsisDapCommand) { - if (this->msSendCommandDelay > 0) { + if (this->msSendCommandDelay.count() > 0) { using namespace std::chrono; long now = duration_cast(high_resolution_clock::now().time_since_epoch()).count(); long difference = (now - this->lastCommandSentTimeStamp); - if (difference < this->msSendCommandDelay) { - std::this_thread::sleep_for(milliseconds(this->msSendCommandDelay - difference)); + if (difference < this->msSendCommandDelay.count()) { + std::this_thread::sleep_for(milliseconds(this->msSendCommandDelay.count() - difference)); } this->lastCommandSentTimeStamp = now; diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.hpp index f51ca608..a1d6a87e 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/CmsisDapInterface.hpp @@ -35,8 +35,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap * Setting msSendCommandDelay to any value above 0 will enforce an x millisecond gap between each command * being sent, where x is the value of msSendCommandDelay. */ - int msSendCommandDelay = 0; - long lastCommandSentTimeStamp; + std::chrono::milliseconds msSendCommandDelay = std::chrono::milliseconds(0); + long lastCommandSentTimeStamp = 0; public: explicit CmsisDapInterface() = default; @@ -45,16 +45,12 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap return this->usbHidInterface; } - void setUsbHidInterface(Usb::HidInterface& usbHidInterface) { - this->usbHidInterface = usbHidInterface; - } - size_t getUsbHidInputReportSize() { return this->usbHidInterface.getInputReportSize(); } - void setMinimumCommandTimeGap(int millisecondTimeGap) { - this->msSendCommandDelay = millisecondTimeGap; + void setMinimumCommandTimeGap(std::chrono::milliseconds commandTimeGap) { + this->msSendCommandDelay = commandTimeGap; } /** diff --git a/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp b/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp index 8a7f662c..63a2a886 100644 --- a/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp +++ b/src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp @@ -94,8 +94,8 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8 /** * Should retrieve the AVR8 target signature of the AVR8 target. * - * This method may invoke stop(), as some interfaces are known to require the target to be in a stopped - * state before the signature can be read. + * This method may invoke stop(), as the target may be required to be in a halted state before the signature + * can be read. * * @return */ diff --git a/src/Targets/TargetDescription/TargetDescriptionFile.cpp b/src/Targets/TargetDescription/TargetDescriptionFile.cpp index 766ce062..8a5918b8 100644 --- a/src/Targets/TargetDescription/TargetDescriptionFile.cpp +++ b/src/Targets/TargetDescription/TargetDescriptionFile.cpp @@ -29,7 +29,6 @@ void TargetDescriptionFile::init(const QDomDocument& xml) { this->xml = xml; auto device = xml.elementsByTagName("device").item(0).toElement(); - if (!device.isElement()) { throw TargetDescriptionParsingFailureException("Device element not found."); } @@ -51,9 +50,9 @@ std::string TargetDescriptionFile::getTargetName() const { AddressSpace TargetDescriptionFile::generateAddressSpaceFromXml(const QDomElement& xmlElement) { if ( !xmlElement.hasAttribute("id") - || !xmlElement.hasAttribute("name") - || !xmlElement.hasAttribute("size") - || !xmlElement.hasAttribute("start") + || !xmlElement.hasAttribute("name") + || !xmlElement.hasAttribute("size") + || !xmlElement.hasAttribute("start") ) { throw Exception("Address space element missing id/name/size/start attributes."); } @@ -88,7 +87,7 @@ AddressSpace TargetDescriptionFile::generateAddressSpaceFromXml(const QDomElemen segmentNodes.item(segmentIndex).toElement() ); - if (memorySegments.find(segment.type) == memorySegments.end()) { + if (!memorySegments.contains(segment.type)) { memorySegments.insert( std::pair< MemorySegmentType, @@ -110,9 +109,9 @@ AddressSpace TargetDescriptionFile::generateAddressSpaceFromXml(const QDomElemen MemorySegment TargetDescriptionFile::generateMemorySegmentFromXml(const QDomElement& xmlElement) { if ( !xmlElement.hasAttribute("type") - || !xmlElement.hasAttribute("name") - || !xmlElement.hasAttribute("size") - || !xmlElement.hasAttribute("start") + || !xmlElement.hasAttribute("name") + || !xmlElement.hasAttribute("size") + || !xmlElement.hasAttribute("start") ) { throw Exception("Missing type/name/size/start attributes"); } diff --git a/src/Targets/TargetDescriptionFiles/AVR8/TINY/ATTINY1624.xml b/src/Targets/TargetDescriptionFiles/AVR8/TINY/ATTINY1624.xml index 38388913..dc94d7d9 100644 --- a/src/Targets/TargetDescriptionFiles/AVR8/TINY/ATTINY1624.xml +++ b/src/Targets/TargetDescriptionFiles/AVR8/TINY/ATTINY1624.xml @@ -1,5 +1,5 @@ - + @@ -172,9 +172,6 @@ - - - diff --git a/src/Targets/TargetDescriptionFiles/AVR8/TINY/ATTINY43U.xml b/src/Targets/TargetDescriptionFiles/AVR8/TINY/ATTINY43U.xml index ac1955a3..de3fa446 100644 --- a/src/Targets/TargetDescriptionFiles/AVR8/TINY/ATTINY43U.xml +++ b/src/Targets/TargetDescriptionFiles/AVR8/TINY/ATTINY43U.xml @@ -1,7 +1,8 @@ - + + @@ -37,10 +38,30 @@ + + + + + + + + + + + + + + + + + + + + @@ -782,4 +803,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +