The Universal Asynchronous Receiver/Transmitter (UART) is
one of the oldest hardware peripherals, and yet it is is still present in many embedded
systems created today. I'm not sure when it was invented, but Wikipedia says it was designed by Gordon Bell at DEC for the PDP series machines. It
was present on the original IBM PC, and is still present in most SoC designs. UARTs can be found on boards like the ARM Versatile Express and Panda. Even mobile devices which don't seem to have any RS-232 connectors
sticking out may have UARTs inside for things like Bluetooth and Infrared
(IrDA).
The recent article on Creating SystemC TLM-2.0 Peripheral Models
used a UART as an example to describe the Virtual System Platform model creation flow, and it
occurred to me I could share some more concepts of what can be done with a UART
in Virtual Platforms.
One of the reasons why the UART is so universal is because
it can be used for many tasks. In fact, most systems have multiple UARTs
because they have multiple purposes. A recent SoC I looked at had 6 of them. One
of the things I like most about Virtual Platforms is the opportunity to do many
kinds of programming. Sure, modeling hardware is interesting. It's also
interesting to work with operating systems and software stacks like embedded
Linux, Android, and FreeRTOS, but one of the most interesting things is to see all of the
different and creative ways people come up with to build the environment around
the hardware models of a Virtual Platform. Last year, I asked a Virtual Platform user (embedded software engineer) how he interacted with his simulated software. His response was through the UARTs. In fact, everything he did to control and communicate with the simulation was via a UART.
To illustrate, I'm going to write a short series of articles
on the applications of the UART in Virtual Platforms. I'll look at four ways
Virtual Platforms interact with UARTs.
Below is a simple block diagram of the UART. Assume the UART model
was generated from a register description and behavior was added to implement
UART functionality. The UART communicates by sending data and receiving data.
For the Virtual Platform we assume rx is a byte of data coming into the UART
model (receive data) and the tx is a byte of data being transmitted out from
the UART (send data). A real UART may have additional signals like Clear
to Send (CTS) and Request to Send (RTS), but we won't worry about these in a
behavioral model.

Some of the UART connections we will look at are:
1.
Connecting to an xterm for an interactive
terminal
2.
Using telnet to connect to the UART for an
interactive terminal
3.
Using a socket to connect gdb and its remote
debugging protocol to a gdbserver running in the simulated target system
4.
Bridging a UART to an RTOS logging program
running on the host machine
There may be other ideas you can think of or other ways you
used the UART in the past so feel free to share them, and be sure to check back soon for more articles on the venerable UART.
Jason Andrews