Hi all,

I would like to know the details about controlling openocd via TCP/IP
(port 6666). I have been experimenting with it, and  I hope I'm doing
something wrong, because it does not seem to work. 

I can connect to the openocd server, but any "command word" such as
"reset" or "halt", sent has no effect. By studying the loopback network
TCP/IP activity with Wireshark, I was able to see that the openocd
server returns one ACK message after each command sent by the client,
but no data (length=0).

The openocd version I used was compiled from today's git sources.

For issuing TCP/IP messages, the following tcl program was used (based
on a snippet posted by Charles Hardin):

        #!/usr/bin/tclsh
        # Simple tcl client to test tcl_server
        puts "Use empty line to exit"
        set fo [socket localhost 6666]
        puts -nonewline stdout "> "
        flush stdout
        while {[gets stdin line] > 0} {
                puts "Message \"$line\" sent!"
                puts $fo $line
                flush $fo
        
        #       #OPENOCD SERVER ONLY RETURNS ACKS (NO DATA), SO THE "GETS" IS
        BLOCKING
        #       puts "Waiting for server response"
        #       if {[eof $fo] || [catch {gets $fo line}]} {
        #               close $fo
        #               puts "Connection or server error."
        #       } else {
        #               puts "Server returned: $line"
        #       }
                
                puts -nonewline stdout "> "
                flush stdout
        }
        close $fo


I have also attached some Wireshark captured data, in plain text format.

Thank you!
No.     Time        Source                Destination           Protocol Info
      1 0.000000    127.0.0.1             127.0.0.1             TCP      56676 
> ircu [SYN] Seq=0 Win=32792 Len=0 MSS=16396 SACK_PERM=1 TSV=8764451 TSER=0 WS=7

Frame 1: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 56676 (56676), Dst Port: ircu (6666), 
Seq: 0, Len: 0
    Source port: 56676 (56676)
    Destination port: ircu (6666)
    [Stream index: 0]
    Sequence number: 0    (relative sequence number)
    Header length: 40 bytes
    Flags: 0x02 (SYN)
    Window size: 32792
    Checksum: 0xfe30 [validation disabled]
    Options: (20 bytes)

No.     Time        Source                Destination           Protocol Info
      2 0.000031    127.0.0.1             127.0.0.1             TCP      ircu > 
56676 [SYN, ACK] Seq=0 Ack=1 Win=32768 Len=0 MSS=16396 SACK_PERM=1 TSV=8764451 
TSER=8764451 WS=2

Frame 2: 74 bytes on wire (592 bits), 74 bytes captured (592 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: ircu (6666), Dst Port: 56676 (56676), 
Seq: 0, Ack: 1, Len: 0
    Source port: ircu (6666)
    Destination port: 56676 (56676)
    [Stream index: 0]
    Sequence number: 0    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 40 bytes
    Flags: 0x12 (SYN, ACK)
    Window size: 32768
    Checksum: 0xfe30 [validation disabled]
    Options: (20 bytes)
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 1]
        [The RTT to ACK the segment was: 0.000031000 seconds]

No.     Time        Source                Destination           Protocol Info
      3 0.000063    127.0.0.1             127.0.0.1             TCP      56676 
> ircu [ACK] Seq=1 Ack=1 Win=32896 Len=0 TSV=8764451 TSER=8764451

Frame 3: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 56676 (56676), Dst Port: ircu (6666), 
Seq: 1, Ack: 1, Len: 0
    Source port: 56676 (56676)
    Destination port: ircu (6666)
    [Stream index: 0]
    Sequence number: 1    (relative sequence number)
    Acknowledgement number: 1    (relative ack number)
    Header length: 32 bytes
    Flags: 0x10 (ACK)
    Window size: 32896 (scaled)
    Checksum: 0xfe28 [validation disabled]
    Options: (12 bytes)
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 2]
        [The RTT to ACK the segment was: 0.000032000 seconds]

No.     Time        Source                Destination           Protocol Info
      4 13.671042   127.0.0.1             127.0.0.1             TCP      56676 
> ircu [PSH, ACK] Seq=1 Ack=1 Win=32896 Len=6 TSV=8765819 TSER=8764451

Frame 4: 72 bytes on wire (576 bits), 72 bytes captured (576 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 56676 (56676), Dst Port: ircu (6666), 
Seq: 1, Ack: 1, Len: 6
    Source port: 56676 (56676)
    Destination port: ircu (6666)
    [Stream index: 0]
    Sequence number: 1    (relative sequence number)
    [Next sequence number: 7    (relative sequence number)]
    Acknowledgement number: 1    (relative ack number)
    Header length: 32 bytes
    Flags: 0x18 (PSH, ACK)
    Window size: 32896 (scaled)
    Checksum: 0xfe2e [validation disabled]
    Options: (12 bytes)
    [SEQ/ACK analysis]
        [Number of bytes in flight: 6]
Data (6 bytes)

0000  68 61 6c 74 0d 0a                                 halt..
    Data: 68616c740d0a
    [Length: 6]

No.     Time        Source                Destination           Protocol Info
      5 13.671066   127.0.0.1             127.0.0.1             TCP      ircu > 
56676 [ACK] Seq=1 Ack=7 Win=32768 Len=0 TSV=8765819 TSER=8765819

Frame 5: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 
(00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: ircu (6666), Dst Port: 56676 (56676), 
Seq: 1, Ack: 7, Len: 0
    Source port: ircu (6666)
    Destination port: 56676 (56676)
    [Stream index: 0]
    Sequence number: 1    (relative sequence number)
    Acknowledgement number: 7    (relative ack number)
    Header length: 32 bytes
    Flags: 0x10 (ACK)
    Window size: 32768 (scaled)
    Checksum: 0xfe28 [validation disabled]
    Options: (12 bytes)
    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 4]
        [The RTT to ACK the segment was: 0.000024000 seconds]
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to