Tidying
This commit is contained in:
@@ -209,7 +209,6 @@ namespace Bloom
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts or generates project settings.
|
* Extracts or generates project settings.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
void loadProjectSettings();
|
void loadProjectSettings();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.hpp"
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.hpp"
|
||||||
|
|
||||||
@@ -20,19 +21,19 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
*/
|
*/
|
||||||
[[nodiscard]] std::vector<unsigned char> getData() const override;
|
[[nodiscard]] std::vector<unsigned char> getData() const override;
|
||||||
|
|
||||||
[[nodiscard]] size_t getFragmentNumber() const {
|
[[nodiscard]] std::size_t getFragmentNumber() const {
|
||||||
return this->fragmentNumber;
|
return this->fragmentNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFragmentNumber(size_t fragmentNumber) {
|
void setFragmentNumber(std::size_t fragmentNumber) {
|
||||||
this->fragmentNumber = fragmentNumber;
|
this->fragmentNumber = fragmentNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] size_t getFragmentCount() const {
|
[[nodiscard]] std::size_t getFragmentCount() const {
|
||||||
return this->fragmentCount;
|
return this->fragmentCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFragmentCount(size_t fragmentCount) {
|
void setFragmentCount(std::size_t fragmentCount) {
|
||||||
this->fragmentCount = fragmentCount;
|
this->fragmentCount = fragmentCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,8 +46,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t fragmentNumber = 1;
|
std::size_t fragmentNumber = 1;
|
||||||
size_t fragmentCount = 1;
|
std::size_t fragmentCount = 1;
|
||||||
|
|
||||||
std::vector<unsigned char> commandPacket;
|
std::vector<unsigned char> commandPacket;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
|
|
||||||
#include "src/Exceptions/InvalidConfig.hpp"
|
#include "src/Exceptions/InvalidConfig.hpp"
|
||||||
#include "src/TargetController/Exceptions/DeviceInitializationFailure.hpp"
|
#include "src/TargetController/Exceptions/DeviceInitializationFailure.hpp"
|
||||||
@@ -58,7 +58,7 @@ void EdbgAvr8Interface::configure(const TargetConfig& targetConfig) {
|
|||||||
if (physicalInterface.empty()
|
if (physicalInterface.empty()
|
||||||
|| availablePhysicalInterfaces.find(physicalInterface) == availablePhysicalInterfaces.end()
|
|| availablePhysicalInterfaces.find(physicalInterface) == availablePhysicalInterfaces.end()
|
||||||
) {
|
) {
|
||||||
throw InvalidConfig("Invalid physical interface config parameter for AVR8 target.");
|
throw InvalidConfig("Invalid or missing physical interface config parameter for AVR8 target.");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto selectedPhysicalInterface = availablePhysicalInterfaces.find(physicalInterface)->second;
|
auto selectedPhysicalInterface = availablePhysicalInterfaces.find(physicalInterface)->second;
|
||||||
@@ -535,8 +535,9 @@ void EdbgAvr8Interface::writeRegisters(const Targets::TargetRegisters& registers
|
|||||||
|
|
||||||
if (registerValue.size() > registerDescriptor.size) {
|
if (registerValue.size() > registerDescriptor.size) {
|
||||||
throw Exception("Register value exceeds size specified by register descriptor.");
|
throw Exception("Register value exceeds size specified by register descriptor.");
|
||||||
|
}
|
||||||
|
|
||||||
} else if (registerValue.size() < registerDescriptor.size) {
|
if (registerValue.size() < registerDescriptor.size) {
|
||||||
// Fill the missing most-significant bytes with 0x00
|
// Fill the missing most-significant bytes with 0x00
|
||||||
registerValue.insert(registerValue.begin(), registerDescriptor.size - registerValue.size(), 0x00);
|
registerValue.insert(registerValue.begin(), registerDescriptor.size - registerValue.size(), 0x00);
|
||||||
}
|
}
|
||||||
@@ -1476,7 +1477,7 @@ void EdbgAvr8Interface::refreshTargetState() {
|
|||||||
auto avrEvent = this->getAvrEvent();
|
auto avrEvent = this->getAvrEvent();
|
||||||
|
|
||||||
if (avrEvent != nullptr && avrEvent->getEventId() == AvrEventId::AVR8_BREAK_EVENT) {
|
if (avrEvent != nullptr && avrEvent->getEventId() == AvrEventId::AVR8_BREAK_EVENT) {
|
||||||
auto breakEvent = dynamic_cast<BreakEvent*>(avrEvent.get());
|
auto* breakEvent = dynamic_cast<BreakEvent*>(avrEvent.get());
|
||||||
|
|
||||||
if (breakEvent == nullptr) {
|
if (breakEvent == nullptr) {
|
||||||
throw Exception("Failed to process AVR8 break event");
|
throw Exception("Failed to process AVR8 break event");
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Bloom
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static std::string projectConfigPath() {
|
static std::string projectConfigPath() {
|
||||||
return std::filesystem::current_path().string() + "/bloom.json";
|
return Paths::projectDirPath() + "/bloom.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,7 +48,7 @@ namespace Bloom
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static std::string projectSettingsDirPath() {
|
static std::string projectSettingsDirPath() {
|
||||||
return std::filesystem::current_path().string() + "/.bloom";
|
return Paths::projectDirPath() + "/.bloom";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +57,7 @@ namespace Bloom
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static std::string projectSettingsPath() {
|
static std::string projectSettingsPath() {
|
||||||
return std::filesystem::current_path().string() + "/.bloom/settings.json";
|
return Paths::projectSettingsDirPath() + "/settings.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ RegisterGroupWidget::RegisterGroupWidget(
|
|||||||
bodyLayout->setContentsMargins(0, 0,0,0);
|
bodyLayout->setContentsMargins(0, 0,0,0);
|
||||||
bodyLayout->setSpacing(0);
|
bodyLayout->setSpacing(0);
|
||||||
|
|
||||||
for (auto& descriptor : registerDescriptors) {
|
for (const auto& descriptor : registerDescriptors) {
|
||||||
if (!descriptor.name.has_value()) {
|
if (!descriptor.name.has_value()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -117,14 +117,14 @@ void RegisterGroupWidget::expand() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RegisterGroupWidget::setAllRegistersVisible(bool visible) {
|
void RegisterGroupWidget::setAllRegistersVisible(bool visible) {
|
||||||
for (auto& registerWidget : this->registerWidgets) {
|
for (const auto& registerWidget : this->registerWidgets) {
|
||||||
registerWidget->setVisible(visible);
|
registerWidget->setVisible(visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterGroupWidget::filterRegisters(const std::string& keyword) {
|
void RegisterGroupWidget::filterRegisters(const std::string& keyword) {
|
||||||
int matchingWidgetCount = 0;
|
int matchingWidgetCount = 0;
|
||||||
for (auto& registerWidget : this->registerWidgets) {
|
for (const auto& registerWidget : this->registerWidgets) {
|
||||||
if (keyword.empty()
|
if (keyword.empty()
|
||||||
|| (registerWidget->descriptor.name.value().find(keyword) != std::string::npos)
|
|| (registerWidget->descriptor.name.value().find(keyword) != std::string::npos)
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ TargetRegistersPaneWidget::TargetRegistersPaneWidget(
|
|||||||
void TargetRegistersPaneWidget::filterRegisters(const QString& keyword) {
|
void TargetRegistersPaneWidget::filterRegisters(const QString& keyword) {
|
||||||
auto stdKeyword = keyword.toLower().toStdString();
|
auto stdKeyword = keyword.toLower().toStdString();
|
||||||
|
|
||||||
for (auto& registerGroupWidget : this->registerGroupWidgets) {
|
for (const auto& registerGroupWidget : this->registerGroupWidgets) {
|
||||||
// If the group name matches the keyword, then don't bother iterating through all the register widgets
|
// If the group name matches the keyword, then don't bother iterating through all the register widgets
|
||||||
if (keyword.isEmpty() || registerGroupWidget->name.contains(keyword, Qt::CaseInsensitive)) {
|
if (keyword.isEmpty() || registerGroupWidget->name.contains(keyword, Qt::CaseInsensitive)) {
|
||||||
registerGroupWidget->setVisible(true);
|
registerGroupWidget->setVisible(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user