Before the USB arrived, we used Serial port to communicate with devices. As soon as this function is written, you can use the printf() function provided by the SDK.
NAME write - send the data on a serial port SYNOPSIS int write(const char* buf, size_t count) DESCRIPTION write() sends up to count bytes from the buffer to the serial port COM1 RETURN VALUE write() returns the number of bytes sent or -1 if an error occured.
- Initialize uart 16550 for 38400 bps
- Implement write() as described in the syscall interface
- You can use
Ctrl-Alt-3in qemu to get access to the virtual machine’s serial console
- There is 4 ports with different base addresses:
- COM1 has 0x3F8 as base address
- COM2 has 0x2F8
- COM3 has 0x3E8
- COM4 has 0x2E8
- You can run qemu with
-serial stdioredirect the virtual serial port to the standard input/output.