diff --git a/src/Targets/TargetDescription/MemorySegment.hpp b/src/Targets/TargetDescription/MemorySegment.hpp index f72a4eb6..f2747d48 100644 --- a/src/Targets/TargetDescription/MemorySegment.hpp +++ b/src/Targets/TargetDescription/MemorySegment.hpp @@ -4,6 +4,7 @@ #include #include "src/Targets/TargetMemorySegmentType.hpp" +#include "src/Targets/TargetMemory.hpp" #include "MemorySegmentSection.hpp" @@ -17,18 +18,20 @@ namespace Targets::TargetDescription std::string key; std::string name; TargetMemorySegmentType type; - std::uint32_t startAddress; - std::uint32_t size; - std::optional pageSize; + TargetMemoryAddress startAddress; + TargetMemorySize size; + TargetMemoryAccess access; + std::optional pageSize; std::map> sectionsByKey; MemorySegment( const std::string& key, const std::string& name, TargetMemorySegmentType type, - std::uint32_t startAddress, - std::uint32_t size, - const std::optional& pageSize, + TargetMemoryAddress startAddress, + TargetMemorySize size, + const TargetMemoryAccess& access, + const std::optional& pageSize, const std::map>& sectionsByKey ) : key(key) @@ -36,6 +39,7 @@ namespace Targets::TargetDescription , type(type) , startAddress(startAddress) , size(size) + , access(access) , pageSize(pageSize) , sectionsByKey(sectionsByKey) {} diff --git a/src/Targets/TargetDescription/TargetDescriptionFile.cpp b/src/Targets/TargetDescription/TargetDescriptionFile.cpp index a8f0851f..8fe2e3da 100644 --- a/src/Targets/TargetDescription/TargetDescriptionFile.cpp +++ b/src/Targets/TargetDescription/TargetDescriptionFile.cpp @@ -394,6 +394,7 @@ namespace Targets::TargetDescription } const auto pageSize = TargetDescriptionFile::tryGetAttribute(xmlElement, "page-size"); + const auto accessString = TargetDescriptionFile::tryGetAttribute(xmlElement, "rw"); auto output = MemorySegment( TargetDescriptionFile::getAttribute(xmlElement, "key"), @@ -401,8 +402,13 @@ namespace Targets::TargetDescription *type, StringService::toUint32(TargetDescriptionFile::getAttribute(xmlElement, "start")), StringService::toUint32(TargetDescriptionFile::getAttribute(xmlElement, "size")), + TargetMemoryAccess( + accessString.has_value() ? accessString->find('R') != std::string::npos : true, + accessString.has_value() ? accessString->find('W') != std::string::npos : true, + accessString.has_value() ? accessString->find('W') != std::string::npos : true + ), pageSize.has_value() - ? std::optional(StringService::toUint16(*pageSize)) + ? std::optional(StringService::toUint32(*pageSize)) : std::nullopt, {} );