litex-hub / wishbone-utils

Utilities for working with a Wishbone bus in an embedded device
Apache License 2.0
41 stars 12 forks source link

Add support for exposing UARTs to TCP #39

Open xobs opened 3 years ago

xobs commented 3 years ago

Add support for connecting Wishbone UARTs to a TCP socket. This gives several benefits:

  1. Support for multiple UARTs. Each UART could get its own TCP server, which will allow for multiplexing across a single Wishbone bridge
  2. Enable network-aware programs such as gdb to attach to a gdbserver that's normally exposed over serial
  3. Allow for a user to use their own terminal emulator to connect to the serial program

Drawbacks to this are:

  1. The user may not have a telnet program installed
  2. The user may not have permission to create network servers
  3. Opening a network server carries risks such as opening a public server on a public IP

An alternative is to use openpty(3) for each serial port. This also gives several benefits:

  1. Support for multiple UARTs, exactly the same way that a TCP server supports.
  2. Any program that speaks serial natively will "just work" by accessing the PTY file
  3. Since no network connection is created, the server is self-contained.

Drawbacks to openpty(3) are:

  1. openpty(3) is not part of a standard, and is a BSD-ism. Therefore it does not exist on platforms such as Windows.

Overall I'm more inclined to go with the TCP approach simply because of the cross-platform compatibility issue.

mithro commented 3 years ago

Can we just support both?