2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <QDomElement>
|
|
|
|
|
|
|
|
|
|
#include "src/Helpers/BiMap.hpp"
|
|
|
|
|
|
2021-05-31 01:01:14 +01:00
|
|
|
namespace Bloom::Targets::TargetDescription
|
2021-04-04 21:04:12 +01:00
|
|
|
{
|
2022-03-01 20:35:56 +00:00
|
|
|
enum class MemorySegmentType
|
2021-06-22 23:52:31 +01:00
|
|
|
{
|
2021-04-04 21:04:12 +01:00
|
|
|
REGISTERS,
|
|
|
|
|
IO,
|
|
|
|
|
EEPROM,
|
|
|
|
|
RAM,
|
|
|
|
|
FLASH,
|
|
|
|
|
SIGNATURES,
|
|
|
|
|
FUSES,
|
|
|
|
|
LOCKBITS,
|
|
|
|
|
OSCCAL,
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-31 01:01:14 +01:00
|
|
|
struct MemorySegment
|
|
|
|
|
{
|
2021-04-04 21:04:12 +01:00
|
|
|
std::string name;
|
|
|
|
|
MemorySegmentType type;
|
|
|
|
|
std::uint32_t startAddress;
|
|
|
|
|
std::uint32_t size;
|
|
|
|
|
std::optional<std::uint16_t> pageSize;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Mapping of all known memory segment types by their name. Any memory segments belonging to a type
|
|
|
|
|
* not defined in here should be ignored.
|
|
|
|
|
*/
|
|
|
|
|
static const inline BiMap<std::string, MemorySegmentType> typesMappedByName = {
|
|
|
|
|
{"regs", MemorySegmentType::REGISTERS},
|
|
|
|
|
{"io", MemorySegmentType::IO},
|
|
|
|
|
{"eeprom", MemorySegmentType::EEPROM},
|
|
|
|
|
{"ram", MemorySegmentType::RAM},
|
|
|
|
|
{"flash", MemorySegmentType::FLASH},
|
|
|
|
|
{"signatures", MemorySegmentType::SIGNATURES},
|
|
|
|
|
{"fuses", MemorySegmentType::FUSES},
|
|
|
|
|
{"lockbits", MemorySegmentType::LOCKBITS},
|
|
|
|
|
{"osccal", MemorySegmentType::OSCCAL},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|