Moved memory segment types to Target scope

This commit is contained in:
Nav
2024-03-14 21:48:55 +00:00
parent 75d5124265
commit 289d1cd3b4
3 changed files with 17 additions and 32 deletions

View File

@@ -13,7 +13,6 @@ namespace Targets::Microchip::Avr::Avr8Bit::TargetDescription
using Targets::TargetDescription::RegisterGroup; using Targets::TargetDescription::RegisterGroup;
using Targets::TargetDescription::AddressSpace; using Targets::TargetDescription::AddressSpace;
using Targets::TargetDescription::MemorySegment; using Targets::TargetDescription::MemorySegment;
using Targets::TargetDescription::MemorySegmentType;
using Targets::TargetDescription::Register; using Targets::TargetDescription::Register;
using Targets::TargetVariant; using Targets::TargetVariant;
using Targets::TargetRegisterDescriptor; using Targets::TargetRegisterDescriptor;

View File

@@ -3,6 +3,8 @@
#include <cstdint> #include <cstdint>
#include <optional> #include <optional>
#include "src/Targets/TargetMemorySegmentType.hpp"
#include "MemorySegmentSection.hpp" #include "MemorySegmentSection.hpp"
#include "src/Services/StringService.hpp" #include "src/Services/StringService.hpp"
@@ -10,27 +12,11 @@
namespace Targets::TargetDescription namespace Targets::TargetDescription
{ {
enum class MemorySegmentType: std::uint8_t
{
ALIASED,
REGISTERS,
EEPROM,
FLASH,
FUSES,
IO,
RAM,
LOCKBITS,
OSCCAL,
PRODUCTION_SIGNATURES,
SIGNATURES,
USER_SIGNATURES,
};
struct MemorySegment struct MemorySegment
{ {
std::string key; std::string key;
std::string name; std::string name;
MemorySegmentType type; TargetMemorySegmentType type;
std::uint32_t startAddress; std::uint32_t startAddress;
std::uint32_t size; std::uint32_t size;
std::optional<std::uint16_t> pageSize; std::optional<std::uint16_t> pageSize;
@@ -39,7 +25,7 @@ namespace Targets::TargetDescription
MemorySegment( MemorySegment(
const std::string& key, const std::string& key,
const std::string& name, const std::string& name,
MemorySegmentType type, TargetMemorySegmentType type,
std::uint32_t startAddress, std::uint32_t startAddress,
std::uint32_t size, std::uint32_t size,
const std::optional<std::uint16_t>& pageSize, const std::optional<std::uint16_t>& pageSize,

View File

@@ -369,19 +369,19 @@ namespace Targets::TargetDescription
} }
MemorySegment TargetDescriptionFile::memorySegmentFromXml(const QDomElement& xmlElement) { MemorySegment TargetDescriptionFile::memorySegmentFromXml(const QDomElement& xmlElement) {
static const auto typesByName = BiMap<std::string, MemorySegmentType>({ static const auto typesByName = BiMap<std::string, TargetMemorySegmentType>({
{"aliased", MemorySegmentType::ALIASED}, {"aliased", TargetMemorySegmentType::ALIASED},
{"regs", MemorySegmentType::REGISTERS}, {"regs", TargetMemorySegmentType::REGISTERS},
{"eeprom", MemorySegmentType::EEPROM}, {"eeprom", TargetMemorySegmentType::EEPROM},
{"flash", MemorySegmentType::FLASH}, {"flash", TargetMemorySegmentType::FLASH},
{"fuses", MemorySegmentType::FUSES}, {"fuses", TargetMemorySegmentType::FUSES},
{"io", MemorySegmentType::IO}, {"io", TargetMemorySegmentType::IO},
{"ram", MemorySegmentType::RAM}, {"ram", TargetMemorySegmentType::RAM},
{"lockbits", MemorySegmentType::LOCKBITS}, {"lockbits", TargetMemorySegmentType::LOCKBITS},
{"osccal", MemorySegmentType::OSCCAL}, {"osccal", TargetMemorySegmentType::OSCCAL},
{"production_signatures", MemorySegmentType::PRODUCTION_SIGNATURES}, {"production_signatures", TargetMemorySegmentType::PRODUCTION_SIGNATURES},
{"signatures", MemorySegmentType::SIGNATURES}, {"signatures", TargetMemorySegmentType::SIGNATURES},
{"user_signatures", MemorySegmentType::USER_SIGNATURES}, {"user_signatures", TargetMemorySegmentType::USER_SIGNATURES},
}); });
const auto typeName = TargetDescriptionFile::getAttribute(xmlElement, "type"); const auto typeName = TargetDescriptionFile::getAttribute(xmlElement, "type");