diff --git a/src/DebugServers/GdbRsp/GdbRspDebugServer.cpp b/src/DebugServers/GdbRsp/GdbRspDebugServer.cpp index 81e2f2bd..0ffb78f8 100644 --- a/src/DebugServers/GdbRsp/GdbRspDebugServer.cpp +++ b/src/DebugServers/GdbRsp/GdbRspDebugServer.cpp @@ -219,8 +219,17 @@ namespace Bloom::DebugServers::Gdb Logger::debug("Handling WriteMemory packet"); try { - auto memoryType = this->getMemoryTypeFromGdbAddress(packet.startAddress); - auto startAddress = this->removeMemoryTypeIndicatorFromGdbAddress(packet.startAddress); + const auto memoryType = this->getMemoryTypeFromGdbAddress(packet.startAddress); + + if (memoryType == Targets::TargetMemoryType::FLASH) { + Logger::error( + "GDB client requested a flash memory write - This is not currently supported by Bloom." + ); + this->clientConnection->writePacket(ResponsePacket({'E', '0', '1'})); + return; + } + + const auto startAddress = this->removeMemoryTypeIndicatorFromGdbAddress(packet.startAddress); this->targetControllerConsole.writeMemory(memoryType, startAddress, packet.buffer); this->clientConnection->writePacket(ResponsePacket({'O', 'K'}));