From 8f61c5a8390840f20c8cc8d63a2a009a7aada850 Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 16 Nov 2024 18:54:28 +0000 Subject: [PATCH] Handled flash erase without subsequent flash write commands, in AVR GDB server --- src/DebugServer/Gdb/AvrGdb/CommandPackets/FlashDone.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/DebugServer/Gdb/AvrGdb/CommandPackets/FlashDone.cpp b/src/DebugServer/Gdb/AvrGdb/CommandPackets/FlashDone.cpp index 476e475f..1f7b2344 100644 --- a/src/DebugServer/Gdb/AvrGdb/CommandPackets/FlashDone.cpp +++ b/src/DebugServer/Gdb/AvrGdb/CommandPackets/FlashDone.cpp @@ -29,7 +29,13 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets try { if (!debugSession.programmingSession.has_value()) { - throw Exception{"No active programming session"}; + /* + * GDB will send a VFlashDone packet even it only performs an erase. In this case, there's nothing more + * to do, as erase operations are executed immediately. + */ + targetControllerService.disableProgrammingMode(); + debugSession.connection.writePacket(OkResponsePacket{}); + return; } Logger::info(