Handle mapped program memory segment aliasing properly, on WCH RISC-V targets
- Added `program_segment_key` target config param, to allow the user to specify the desired program memory segment - Added the ability to resolve the currently aliased segment, by means of probing the mapped segment - Added program counter transformation, when the mapped segment is aliasing a foreign segment - Other bites of tidying
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "Exceptions/IllegalMemoryAccess.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
#include "src/Exceptions/InvalidConfig.hpp"
|
||||
#include "src/TargetController/Exceptions/TargetOperationFailure.hpp"
|
||||
@@ -307,6 +309,20 @@ namespace Targets::RiscV
|
||||
return this->programmingMode;
|
||||
}
|
||||
|
||||
bool RiscV::probeMemory(
|
||||
const TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
||||
const TargetMemorySegmentDescriptor& memorySegmentDescriptor,
|
||||
Targets::TargetMemoryAddress address
|
||||
) {
|
||||
try {
|
||||
this->riscVDebugInterface->readMemory(addressSpaceDescriptor, memorySegmentDescriptor, address, 4, {});
|
||||
return true;
|
||||
|
||||
} catch (const Exceptions::IllegalMemoryAccess&) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void RiscV::applyDebugInterfaceAccessRestrictions(TargetAddressSpaceDescriptor& addressSpaceDescriptor) {
|
||||
for (auto& [segmentKey, segmentDescriptor] : addressSpaceDescriptor.segmentDescriptorsByKey) {
|
||||
this->riscVDebugInterface->applyAccessRestrictions(segmentDescriptor);
|
||||
|
||||
Reference in New Issue
Block a user