ISP parameter struct and TDF extraction
This commit is contained in:
@@ -284,6 +284,98 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
|
||||
return targetParameters;
|
||||
}
|
||||
|
||||
IspParameters TargetDescriptionFile::getIspParameters() const {
|
||||
if (!this->propertyGroupsMappedByName.contains("isp_interface")) {
|
||||
throw Exception("TDF missing ISP parameters");
|
||||
}
|
||||
|
||||
const auto& ispParameterPropertiesByName = this->propertyGroupsMappedByName.at(
|
||||
"isp_interface"
|
||||
).propertiesMappedByName;
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispenterprogmode_timeout")) {
|
||||
throw Exception("TDF missing ISP programming mode timeout property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispenterprogmode_stabdelay")) {
|
||||
throw Exception("TDF missing ISP programming mode stabilization delay property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispenterprogmode_cmdexedelay")) {
|
||||
throw Exception("TDF missing ISP programming mode command execution delay property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispenterprogmode_synchloops")) {
|
||||
throw Exception("TDF missing ISP programming mode sync loops property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispenterprogmode_bytedelay")) {
|
||||
throw Exception("TDF missing ISP programming mode byte delay property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispenterprogmode_pollindex")) {
|
||||
throw Exception("TDF missing ISP programming mode poll index property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispenterprogmode_pollvalue")) {
|
||||
throw Exception("TDF missing ISP programming mode poll value property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispleaveprogmode_predelay")) {
|
||||
throw Exception("TDF missing ISP programming mode pre-delay property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispleaveprogmode_postdelay")) {
|
||||
throw Exception("TDF missing ISP programming mode post-delay property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispreadsign_pollindex")) {
|
||||
throw Exception("TDF missing ISP read signature poll index property");
|
||||
}
|
||||
|
||||
if (!ispParameterPropertiesByName.contains("ispreadfuse_pollindex")) {
|
||||
throw Exception("TDF missing ISP read fuse poll index property");
|
||||
}
|
||||
|
||||
auto output = IspParameters();
|
||||
|
||||
output.programModeTimeout = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispenterprogmode_timeout").value.toUShort()
|
||||
);
|
||||
output.programModeStabilizationDelay = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispenterprogmode_stabdelay").value.toUShort()
|
||||
);
|
||||
output.programModeCommandExecutionDelay = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispenterprogmode_cmdexedelay").value.toUShort()
|
||||
);
|
||||
output.programModeSyncLoops = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispenterprogmode_synchloops").value.toUShort()
|
||||
);
|
||||
output.programModeByteDelay = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispenterprogmode_bytedelay").value.toUShort()
|
||||
);
|
||||
output.programModePollValue = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispenterprogmode_pollvalue").value.toUShort(nullptr, 16)
|
||||
);
|
||||
output.programModePollIndex = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispenterprogmode_pollindex").value.toUShort()
|
||||
);
|
||||
output.programModePreDelay = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispleaveprogmode_predelay").value.toUShort()
|
||||
);
|
||||
output.programModePostDelay = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispleaveprogmode_postdelay").value.toUShort()
|
||||
);
|
||||
output.readSignaturePollIndex = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispreadsign_pollindex").value.toUShort()
|
||||
);
|
||||
output.readFusePollIndex = static_cast<std::uint8_t>(
|
||||
ispParameterPropertiesByName.at("ispreadfuse_pollindex").value.toUShort()
|
||||
);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void TargetDescriptionFile::loadDebugPhysicalInterfaces() {
|
||||
auto interfaceNamesToInterfaces = std::map<std::string, PhysicalInterface>({
|
||||
{"updi", PhysicalInterface::UPDI},
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "src/Targets/TargetDescription/TargetDescriptionFile.hpp"
|
||||
|
||||
#include "src/Targets/Microchip/AVR/TargetSignature.hpp"
|
||||
#include "src/Targets/Microchip/AVR/IspParameters.hpp"
|
||||
#include "src/Targets/Microchip/AVR/AVR8/Family.hpp"
|
||||
#include "src/Targets/Microchip/AVR/AVR8/PhysicalInterface.hpp"
|
||||
#include "src/Targets/Microchip/AVR/AVR8/TargetParameters.hpp"
|
||||
@@ -72,6 +73,13 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
|
||||
*/
|
||||
[[nodiscard]] TargetParameters getTargetParameters() const;
|
||||
|
||||
/**
|
||||
* Extracts the target's ISP parameters from the TDF.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]] IspParameters getIspParameters() const;
|
||||
|
||||
/**
|
||||
* Returns a set of all supported physical interfaces for debugging.
|
||||
*
|
||||
|
||||
26
src/Targets/Microchip/AVR/IspParameters.hpp
Normal file
26
src/Targets/Microchip/AVR/IspParameters.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Bloom::Targets::Microchip::Avr
|
||||
{
|
||||
/**
|
||||
* These parameters are required by the ISP interface. They can be extracted from the target's TDF.
|
||||
*/
|
||||
struct IspParameters
|
||||
{
|
||||
std::uint8_t programModeTimeout;
|
||||
std::uint8_t programModeStabilizationDelay;
|
||||
std::uint8_t programModeCommandExecutionDelay;
|
||||
std::uint8_t programModeSyncLoops;
|
||||
std::uint8_t programModeByteDelay;
|
||||
std::uint8_t programModePollValue;
|
||||
std::uint8_t programModePollIndex;
|
||||
std::uint8_t programModePreDelay;
|
||||
std::uint8_t programModePostDelay;
|
||||
|
||||
std::uint8_t readSignaturePollIndex;
|
||||
|
||||
std::uint8_t readFusePollIndex;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user