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
|
|
|
|
2025-02-02 13:32:25 +00:00
|
|
|
namespace DebugToolDrivers::Protocols::RiscVDebug
|
2024-10-06 23:32:36 +01:00
|
|
|
{
|
|
|
|
|
DebugTranslatorConfig::DebugTranslatorConfig(const YAML::Node& configNode) {
|
2024-11-27 20:18:00 +00:00
|
|
|
if (configNode["target_response_timeout"]) {
|
2024-10-06 23:32:36 +01:00
|
|
|
this->targetResponseTimeout = std::chrono::microseconds{
|
2024-11-27 20:18:00 +00:00
|
|
|
configNode["target_response_timeout"].as<std::int64_t>(this->targetResponseTimeout.count())
|
2024-10-06 23:32:36 +01:00
|
|
|
};
|
|
|
|
|
}
|
2024-11-23 20:14:47 +00:00
|
|
|
|
2024-11-27 20:18:00 +00:00
|
|
|
if (configNode["preferred_memory_access_strategy"]) {
|
|
|
|
|
const auto strategy = configNode["preferred_memory_access_strategy"].as<std::string>();
|
2024-11-23 20:14:47 +00:00
|
|
|
|
2024-11-27 20:18:00 +00:00
|
|
|
if (strategy == "abstract_command") {
|
2024-11-23 20:14:47 +00:00
|
|
|
this->preferredMemoryAccessStrategy = DebugModule::MemoryAccessStrategy::ABSTRACT_COMMAND;
|
|
|
|
|
|
2024-11-27 20:18:00 +00:00
|
|
|
} else if (strategy == "program_buffer") {
|
2024-11-23 20:14:47 +00:00
|
|
|
this->preferredMemoryAccessStrategy = DebugModule::MemoryAccessStrategy::PROGRAM_BUFFER;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Logger::error(
|
|
|
|
|
"Invalid value (\"" + strategy + "\") provided for RISC-V debug translator config parameter "
|
2024-11-27 20:18:00 +00:00
|
|
|
"('preferred_memory_access_strategy'). Parameter will be ignored."
|
2024-11-23 20:14:47 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-06 23:32:36 +01:00
|
|
|
}
|
|
|
|
|
}
|