mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 04:39:24 +02:00
RSP - Handle multiple output messages from OpenOCD.
This commit is contained in:
parent
95f84b4b0b
commit
81d8d38c5c
@ -381,10 +381,11 @@ begin
|
|||||||
|
|
||||||
cksum := StrToInt('$' + char(SafeReadByte) + char(SafeReadByte));
|
cksum := StrToInt('$' + char(SafeReadByte) + char(SafeReadByte));
|
||||||
if not (calcSum = cksum) then
|
if not (calcSum = cksum) then
|
||||||
DebugLn(DBG_WARNINGS, ['Warning: Reply packet with invalid checksum: ', retval]);
|
DebugLn(DBG_WARNINGS, ['Warning: Reply packet with invalid checksum: ', retval])
|
||||||
|
else
|
||||||
|
// Acknowledge all replies
|
||||||
|
SafeWriteByte(byte('+'));
|
||||||
|
|
||||||
// Check if this packet is a console output packet, which isn't acknowledged
|
|
||||||
// Todo: display output somewhere
|
|
||||||
if (length(retval) > 2) and (retval[1] = 'O') and (retval[2] <> 'K') then
|
if (length(retval) > 2) and (retval[1] = 'O') and (retval[2] <> 'K') then
|
||||||
begin
|
begin
|
||||||
outputPacket := True;
|
outputPacket := True;
|
||||||
@ -403,10 +404,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
until not outputPacket;
|
until not outputPacket;
|
||||||
|
|
||||||
// Acknowledge all replies
|
|
||||||
SafeWriteByte(byte('+'));
|
|
||||||
result := not SockErr;
|
result := not SockErr;
|
||||||
DebugLn(DBG_RSP, ['RSP <- ', retval]);
|
// Ignore empty output packet unless both RSP and VERBOSE logging is enabled
|
||||||
|
// OpenOCD sends empty output packets while target is running
|
||||||
|
if (retval = 'O') then
|
||||||
|
DebugLn(DBG_RSP and DBG_VERBOSE, ['RSP <- ', retval])
|
||||||
|
else
|
||||||
|
DebugLn(DBG_RSP, ['RSP <- ', retval])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TRspConnection.SendCmdWaitForReply(const cmd: string; out reply: string
|
function TRspConnection.SendCmdWaitForReply(const cmd: string; out reply: string
|
||||||
@ -574,7 +578,7 @@ begin
|
|||||||
EnterCriticalSection(fCS);
|
EnterCriticalSection(fCS);
|
||||||
try
|
try
|
||||||
// -1 if no data could be read, e.g. socket is closed
|
// -1 if no data could be read, e.g. socket is closed
|
||||||
// 0 if timeout. Use timeout so that asynchronous evens such as break can also be processed
|
// 0 if timeout. Use timeout so that asynchronous events such as break can also be processed
|
||||||
i := WaitForData(500);
|
i := WaitForData(500);
|
||||||
if i <= 0 then
|
if i <= 0 then
|
||||||
begin
|
begin
|
||||||
@ -698,7 +702,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
DebugLn(DBG_WARNINGS, ['Unexpected WaitForSignal reply: ', msg]);
|
if msg <> 'O' then // Ignore empty output messages from OpenOCD
|
||||||
|
DebugLn(DBG_WARNINGS, ['Unexpected WaitForSignal reply: ', msg]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user