Removed unnecessary copying when generating raw buffers from EDBG AVR command frames.
This commit is contained in:
@@ -103,9 +103,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] auto getRawCommandFrame() const {
|
[[nodiscard]] auto getRawCommandFrame() const {
|
||||||
auto data = this->getPayload();
|
|
||||||
const auto dataSize = data.size();
|
|
||||||
|
|
||||||
auto rawCommand = std::vector<unsigned char>(5);
|
auto rawCommand = std::vector<unsigned char>(5);
|
||||||
|
|
||||||
rawCommand[0] = this->SOF;
|
rawCommand[0] = this->SOF;
|
||||||
@@ -116,11 +113,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
|
|
||||||
rawCommand[4] = static_cast<unsigned char>(this->getProtocolHandlerId());
|
rawCommand[4] = static_cast<unsigned char>(this->getProtocolHandlerId());
|
||||||
|
|
||||||
if (dataSize > 0) {
|
if (!this->payload.empty()) {
|
||||||
rawCommand.insert(
|
rawCommand.insert(
|
||||||
rawCommand.end(),
|
rawCommand.end(),
|
||||||
data.begin(),
|
this->payload.begin(),
|
||||||
data.end()
|
this->payload.end()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user