2024-10-06 23:32:36 +01:00
|
|
|
#include "DebugTranslatorConfig.hpp"
|
|
|
|
|
|
2024-10-16 21:22:16 +01:00
|
|
|
#include <cstdint>
|
2024-11-23 20:14:47 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include "src/Logger/Logger.hpp"
|
2024-10-16 21:22:16 +01:00
|
|
|
|
2024-10-06 23:32:36 +01:00
|
|
|
namespace DebugToolDrivers::Protocols::RiscVDebugSpec
|
|
|
|
|
{
|
|
|
|
|
DebugTranslatorConfig::DebugTranslatorConfig(const YAML::Node& configNode) {
|
|
|
|
|
if (configNode["targetResponseTimeout"]) {
|
|
|
|
|
this->targetResponseTimeout = std::chrono::microseconds{
|
2024-10-16 21:22:16 +01:00
|
|
|
configNode["targetResponseTimeout"].as<std::int64_t>(this->targetResponseTimeout.count())
|
2024-10-06 23:32:36 +01:00
|
|
|
};
|
|
|
|
|
}
|
2024-11-23 20:14:47 +00:00
|
|
|
|
|
|
|
|
if (configNode["preferredMemoryAccessStrategy"]) {
|
|
|
|
|
const auto strategy = configNode["preferredMemoryAccessStrategy"].as<std::string>();
|
|
|
|
|
|
|
|
|
|
if (strategy == "abstract-command") {
|
|
|
|
|
this->preferredMemoryAccessStrategy = DebugModule::MemoryAccessStrategy::ABSTRACT_COMMAND;
|
|
|
|
|
|
|
|
|
|
} else if (strategy == "program-buffer") {
|
|
|
|
|
this->preferredMemoryAccessStrategy = DebugModule::MemoryAccessStrategy::PROGRAM_BUFFER;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Logger::error(
|
|
|
|
|
"Invalid value (\"" + strategy + "\") provided for RISC-V debug translator config parameter "
|
|
|
|
|
"('preferredMemoryAccessStrategy'). Parameter will be ignored."
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-06 23:32:36 +01:00
|
|
|
}
|
|
|
|
|
}
|