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::AddressSpace;
using Targets::TargetDescription::MemorySegment;
using Targets::TargetDescription::MemorySegmentType;
using Targets::TargetDescription::Register;
using Targets::TargetVariant;
using Targets::TargetRegisterDescriptor;

View File

@@ -3,6 +3,8 @@
#include <cstdint>
#include <optional>
#include "src/Targets/TargetMemorySegmentType.hpp"
#include "MemorySegmentSection.hpp"
#include "src/Services/StringService.hpp"
@@ -10,27 +12,11 @@
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
{
std::string key;
std::string name;
MemorySegmentType type;
TargetMemorySegmentType type;
std::uint32_t startAddress;
std::uint32_t size;
std::optional<std::uint16_t> pageSize;
@@ -39,7 +25,7 @@ namespace Targets::TargetDescription
MemorySegment(
const std::string& key,
const std::string& name,
MemorySegmentType type,
TargetMemorySegmentType type,
std::uint32_t startAddress,
std::uint32_t size,
const std::optional<std::uint16_t>& pageSize,

View File

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